liveBook · Manning

Ready condition

As explained in Kubernetes in Action, Second Edition

Container readiness is the status indicating whether a container is ready to serve its intended workload.

A container’s ready condition indicates whether that container is ready to serve its intended workload. Kubernetes reports it in the container status within the Pod object, alongside the container state, image, container ID, and restart count. section 6.1.3

Readiness is separate from the container’s current state. A container may be Running but not ready, while its state explains whether it is Waiting, Running, Terminated, or Unknown. The ready value focuses on whether the container can serve workload traffic. section 6.1.3

Inspect container readiness at different levels:

  • Use kubectl describe po <pod-name> to view each container’s state, Ready value, and restart count. section 6.1.3
  • Use kubectl get po <pod-name> -o json | jq .status.containerStatuses to inspect the structured status for individual containers. section 6.1.3

Reading a container status

In kubectl describe po kiada, State: Running and Ready: True show that the container is running and reported ready; Restart Count: 0 shows that it has not restarted.

$ kubectl describe po kiada
...
Containers:
  kiada:
    Container ID:   docker://c64944a684d57faacfced0be1af44686...
    Image:          luksa/kiada:0.1
    Image ID:       docker-pullable://luksa/kiada@sha256:3f28...
    Port:           8080/TCP
    Host Port:      0/TCP
    State:          Running                            #1
      Started:      Sun, 02 Feb 2020 12:43:03 +0100    #1
    Ready:          True     #2
    Restart Count:  0      #3
    Environment:    <none>
...

Browse a concrete kubectl output listing the container ID, image, state, readiness, and restart count. section 6.1.3

How Kubernetes in Action, Second Edition covers it

How deep it goes
Distinguishes readiness from container state and Pod readiness, but does not explain the implementation that produces the ready value.
Examples
Demonstrates readiness through kubectl describe output for the kiada container and JSON inspection with jq.
What it assumes
Assumes familiarity with Pods and containers while introducing container state, Pod conditions, and status inspection.
What you can do after
Diagnose container health with kubectl describe and inspect structured readiness data with jq.
How it connects
Connects container readiness with Pod conditions, ContainersReady, readiness gates, container states, and init containers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.