Kubernetes Pod Lifecycle
Understand pod phases, container states, restart policies, and what Kubernetes does when pods or nodes fail.
Why Pod Lifecycle Matters
Pods do not simply move from created to running forever. They pass through phases, containers move between states, and failures trigger recovery behavior.
Pod Phases
| Phase | Meaning |
|---|---|
| Pending | Pod accepted, but containers not fully started yet |
| Running | Pod bound to a node and at least one container is running or starting |
| Succeeded | All containers finished successfully |
| Failed | All containers terminated and at least one failed |
| Unknown | The control plane cannot determine pod state reliably |
Container States
Inside a pod, each container has its own state:
- Waiting
- Running
- Terminated
A pod may be Running while one container inside it restarts repeatedly.
Restart Policies
| Policy | Meaning |
|---|---|
Always | Restart containers whenever they exit |
OnFailure | Restart only if a container exits with failure |
Never | Do not restart automatically |
Deployments typically rely on Always because they are meant for long-running services.
Pod Phase State Machine
Pod phase state machine
Pending
Scheduling or pulling image
Running
At least one container active
Succeeded
All containers exited 0
Failed
Container exited with error
Unknown
Node lost communication
Reading the STATUS Column
The kubectl get pod STATUS column can show values such as:
RunningPendingCrashLoopBackOffImagePullBackOffCompletedError
Some of these are not official pod phases. They are user-friendly status summaries that help explain what is going wrong.
What Happens on Node Failure?
If a node fails, pods on that node may become unreachable. For managed workloads like Deployments, Kubernetes usually creates replacement pods on healthy nodes once the failure is detected.
Key Idea
Pods are disposable. The system is designed to replace them, not treat each one like a precious pet server.
That is a major cloud-native mindset shift.
Pending Meaning
What does the `Pending` pod phase mean?
CrashLoopBackOff Meaning
If `kubectl get pod` shows `CrashLoopBackOff`, what is generally happening?