<p>A pod has two containers: A and B, A needs to call B so it must wait for B to get ready. Currently, my implementation for this readiness detection is using &quot;Readiness Probe&quot;. However, there is a problem. No boolean value like &quot;ready&quot; for the container structure in &quot;k8s.io/api/core/v1.Container&quot;. This does not make sense to me, shouldn't there be such a field so that another container can easily detect the status? Or I made a mistake about this &quot;Readiness Probe&quot; in the first place?</p>
<p>I have noticed that if a container's readiness is not ok, then its container is not going to be created. So maybe I can look through the pod and check if B's container is created, this might be the reason why &quot;k8s.io/api/core/v1.Container&quot; doesn't have a boolean field for &quot;Readiness Probe&quot;.</p>
<p>My question is: <strong>is it ok to use a container's existence as an indicator of &quot;Readiness Probe&quot; ?</strong></p>

Steve Wu
<p>No, the fact that a Pod's container exists does not mean that the Container is ready.
Think about a Java container that takes 30 seconds to bootstrap. The container will be existing and not ready for the first 30 seconds.</p>
<p>What you need to do is check the Container State in the Pod Status: <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-states" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-states</a></p>
<p>More specifically, you need to iterate through the array <code>status.containerStatuses</code> until you find the name of the container you are interested in, and then check the <code>ready</code> field.</p>
<p>From the docs (<a href="https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodStatus" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodStatus</a>):</p>
<blockquote>
<p>containerStatuses.ready (boolean): Specifies whether the container has passed its readiness probe.</p>
</blockquote>
