Is it possible to add a new Container once Pod is created?

3/14/2021

Suppose I have created a Pod having 1 container, now I want to add a second container to it, how can I do that?

-- pjj
google-kubernetes-engine
kubernetes
kubernetes-container
kubernetes-pod

1 Answer

3/14/2021

In general, the answer is "no". Once you have created a Pod, you cannot add a new Container to it.

However, sometimes it's necessary to inspect the state of an existing Pod, however, for example, to troubleshoot a hard-to-reproduce bug. In these cases, you can run an Ephemeral Container in an existing Pod to inspect its state and run arbitrary commands.

However, Ephemeral Containers are not appropriate for running applications because they lack guarantees for resources or execution, and they will never be automatically restarted

-- hagrawal
Source: StackOverflow