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

PhaseMeaning
PendingPod accepted, but containers not fully started yet
RunningPod bound to a node and at least one container is running or starting
SucceededAll containers finished successfully
FailedAll containers terminated and at least one failed
UnknownThe 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

PolicyMeaning
AlwaysRestart containers whenever they exit
OnFailureRestart only if a container exits with failure
NeverDo 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

scheduled + containers start

Running

At least one container active

all completed (0)

Succeeded

All containers exited 0

container exited non-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:

  • Running
  • Pending
  • CrashLoopBackOff
  • ImagePullBackOff
  • Completed
  • Error

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.

Exercise

Pending Meaning

What does the `Pending` pod phase mean?

Exercise

CrashLoopBackOff Meaning

If `kubectl get pod` shows `CrashLoopBackOff`, what is generally happening?

Continue Learning

Explore Related Topics

Try the Tool

Related Resources