Anti-Pattern - Building during Pod starting (Init-Container)?

11/7/2019

I am kind of new to kubernetes, an coworker of mine, who claims he is more experienced, wants to introduce a process where things get built during the init of the pod (init-container).

I guess that's a very bad idea, because building shouldn't be the responsibility of the container and it seems to me like an hack. But he insists because the software which will be delivered by another vendor, can be changed easily, if he introduces a hotfix (init-container gets incremented config downloads new artifact).

I think it's an Anti-Pattern and creates problems, what do you think?

-- noircc
building
kubernetes
kubernetes-pod

1 Answer

11/7/2019

A little look at the official documentation: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/

Init was created to resolve this type of problem where you want to build assets before launching your app... The init container should be more seen like the last part of a CI/CD process...

It allows you to build lighter images without vendors, npm, and others building tools that you may think of that are not needed by your app.

So in this case your coworker seems to be right from what you exlained.

-- night-gold
Source: StackOverflow