How to put k8s multi container pod state to be ready when one of the container is terminated as it completed its task and terminated

5/18/2020

A k8s pod having two containers. One of the containers has finished its job, so its state is as below:

Container1     
  State:          Terminated
  Reason:       Completed
  Ready:          False

Container 2 
    State:          Running
    Ready:          True

And this is what I expect. Container 1should come and exit once the job is done. Container 2 should keep running alone.

But pod having container 1 and container 2 has its state as Not Ready which I want to change to Ready state so that it can be reached by service

How can I bring this pod to Ready state

-- vats
kubernetes

1 Answer

5/18/2020

Kubernetes init containers will satisfy your requirement. Please take a look at here.

-- hariK
Source: StackOverflow