concept condition in category kubernetes

appears as: condition, A condition, Conditions, conditions, The condition
Kubernetes in Action, Second Edition MEAP V05

This is an excerpt from Manning's book Kubernetes in Action, Second Edition MEAP V05.

Note

Inspecting the pod’s conditions

To see the conditions of a pod, you can use kubectl describe as in the next listing:

Listing 6.1 Displaying a pod’s conditions using kubectl describe
$ kubectl describe po kubia | grep Conditions: -A5
Conditions:
  Type              Status
  Initialized       True        #A
  Ready             True        #B
  ContainersReady   True        #B
  PodScheduled      True        #C

The kubectl describe command only shows whether each condition is true or not. To find out why a condition is false, you must inspect the pod manifest, as shown in the next listing.

Listing 6.2 Displaying a pod’s conditions using kubectl and jq
$ kubectl get po kubia -o json | jq .status.conditions
[
  {
    "lastProbeTime": null,
    "lastTransitionTime": "2020-02-02T11:42:59Z",
    "status": "True",
    "type": "Initialized"
  },
  ...

Each condition has a status field that indicates whether the condition is True, False or Unknown. In the case of the kubia pod, the status of all conditions is True, which means they are all fulfilled. The condition can also contain a reason field that specifies a machine-facing reason for the last change of the condition’s status, and a message field that explains the change in detail. The lastTransitionTime field shows when the change occurred, while the lastProbeTime indicates when this condition was last checked.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest