Sub topic 1
Pod phases and what they do and do not tell you
Prerequisites
This chapter assumes you can run kubectl get and kubectl describe, read a YAML manifest, and explain what a pod, a container, and an image are. You do not need any troubleshooting experience.
What a pod phase is
A pod phase is a one-word summary of where a pod is in its life. It is stored in status.phase. Kubernetes defines five values:
| Phase | Meaning |
|---|---|
| Pending | The API server accepted the pod, but one or more containers are not running yet. The pod may be waiting to be scheduled, or waiting for images to download. |
| Running | The pod is bound to a node and at least one container is running, starting, or restarting. |
| Succeeded | All containers exited with code 0 and will not be restarted. |
| Failed | All containers have terminated and at least one exited with a failure. |
| Unknown | The control plane cannot get the pod's state, usually because the node is unreachable. |
The phase is deliberately coarse. It tells you which stage the pod has reached, not whether the application works.
What the phase does not tell you
The phase hides most of the detail you need when debugging. Two examples:
- A pod in
Runningcan be crash-looping. While a container is being restarted, the pod still counts as running. - A pod in
Pendingcan be stuck for two unrelated reasons. The scheduler may not have found a node, or the node may be unable to pull the image.
The STATUS column in kubectl get pods is also not the phase. kubectl builds that text from the phase, the container states, and the pod's conditions. Text such as CrashLoopBackOff, ImagePullBackOff, and OOMKilled comes from container states, which later chapters cover.
kubectl get pod web -o jsonpath='{.status.phase}{"\n"}'
kubectl get podsFor a crash-looping pod, the first command prints Running. The second prints CrashLoopBackOff in the STATUS column.
How the pieces relate
The phase sits at the top. Beneath it are conditions, such as PodScheduled, Initialized, ContainersReady, and Ready. Beneath those are the states of each container.
When the STATUS column shows something specific, such as ImagePullBackOff, it is almost always reporting a container reason. The phase alone would just say Pending.
A common mistake
Many people see Running and conclude the pod is healthy. Check two more things. The READY column shows how many containers pass their readiness checks, and RESTARTS shows whether containers keep dying. A pod showing Running, 0/1 ready, and a growing restart count is failing.
Exercise
A pod shows Running in status.phase, but kubectl get pods shows CrashLoopBackOff in the STATUS column. How can both be true?
Show answer
The phase only says the pod is bound to a node and at least one container is running, starting, or restarting. A container that keeps restarting keeps the pod in Running. kubectl derives STATUS from the container state, which reports the back-off reason CrashLoopBackOff.