liveBook · Manning

Condition

As explained in Kubernetes in Action, Second Edition

A condition is a status entry representing one aspect of a Kubernetes object's current state.

A condition is a status entry describing one aspect of a Kubernetes object’s current state. Objects commonly expose several conditions at once, each reporting whether a particular state is True, False, or Unknown. This makes conditions more informative than a single overall status field and useful for troubleshooting. section 4.2.3 section 6.1.2

A condition can include:

  • type, identifying the state being reported, such as Ready, MemoryPressure, DiskPressure, PodScheduled, or ContainersReady. section 4.2.3 section 6.1.2
  • status, set to True, False, or Unknown. section 4.2.3
  • reason and message, explaining the last change with machine-facing and human-facing details. section 4.2.3
  • timestamps, including lastTransitionTime for status changes and lastHeartbeatTime or lastProbeTime for recent checks. section 4.2.3 section 6.1.2

Diagnosing a node or pod

Inspect a node with `kubectl get node <name> -o json | jq .status.conditions`, or inspect a pod with `kubectl describe po <name>`. For a false condition, read `status.conditions` to find its reason and message. A node’s Ready condition indicates whether it can accept pods; a pod’s Ready condition indicates whether it can provide services. section 4.2.3 section 6.1.2

Table 6.2 List of pod conditions
Pod condition
Description
PodScheduled
Indicates whether the pod has been scheduled to a node.
Initialized
The pod’s init containers have all completed successfully.
ContainersReady
All containers in the pod indicate that they are ready. This is a necessary but not sufficient condition for the entire pod to be ready.
Ready
The pod is ready to provide services to its clients. The containers in the pod and the pod’s readiness gates are all reporting that they are ready. Note: This is explained in chapter 11.

Compare the four documented pod condition types and see how scheduling, initialization, container readiness, and overall pod readiness relate. section 6.1.2

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains condition types, status values, transition metadata, and Node and Pod examples through practical inspection commands.
Examples
Uses Node resource-pressure conditions and Pod scheduling, initialization, container-readiness, and service-readiness conditions.
What you can do after
Diagnose/debug with kubectl by inspecting condition status, reasons, messages, and timestamps for Nodes and Pods.
How it connects
Connects conditions with object status, pod phase, container states, readiness, controllers, and events.

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.