9 Kubernetes Pod Lifecycle and Health
Understanding how Kubernetes manages pod states and ensures application health through lifecycle stages and readiness checks.
Kubernetes Pod Lifecycle and Health is the set of phases, conditions, and probing mechanisms Kubernetes uses to track a Pod from creation to termination, and to determine whether its containers are functioning correctly enough to keep running or to receive traffic at any given moment.
Pod Phases
The Defined Phase Values
Every Pod has a phase field summarizing its position in its overall lifecycle: Pending, indicating the Pod has been accepted but is not yet fully running, Running, indicating it has been bound to a node and at least one container is executing, Succeeded and Failed, indicating all containers have terminated with success or failure respectively, and Unknown, indicating the Pod's state could not be determined.
Phase Is a Summary, Not the Full Picture
The phase field is intentionally coarse. Detailed information about individual containers and specific conditions is tracked separately, since a Pod in the Running phase may still have one of its containers in a crash loop.
Pod Conditions
Types of Conditions
Alongside phase, a Pod carries a set of conditions such as PodScheduled, Initialized, ContainersReady, and Ready, each with a boolean status indicating whether that aspect of the Pod's lifecycle has been satisfied.
The Ready Condition
The Ready condition is particularly significant because it determines whether the Pod should be included as a valid endpoint behind a Service, meaning a Pod can be Running yet still excluded from receiving traffic if it is not Ready.
Container States
Waiting, Running, and Terminated
Each individual container within a Pod has its own state, which is one of Waiting, meaning it is not yet running and may be pulling its image or waiting on a dependency, Running, meaning it is currently executing, or Terminated, meaning it has exited, along with an exit code and reason.
Restart Counts
The kubelet tracks how many times a container has restarted, which is a key signal for diagnosing crash loops, since a rapidly increasing restart count often indicates the container is failing immediately after starting.
Health Probes
Liveness Probes
A liveness probe determines whether a container is still functioning correctly. If a liveness probe fails repeatedly, the kubelet kills the container and restarts it according to the Pod's restart policy, which is useful for recovering from deadlocks that a process cannot self-correct.
Readiness Probes
A readiness probe determines whether a container is ready to accept traffic. Unlike a failed liveness probe, a failed readiness probe does not restart the container, but instead removes the Pod from Service endpoints until the probe succeeds again.
Startup Probes
A startup probe is used for containers that require a long initialization period, disabling liveness and readiness checks until the startup probe succeeds, preventing slow-starting applications from being killed prematurely.
Termination Lifecycle
Graceful Shutdown
When a Pod is deleted, Kubernetes sends a termination signal to its containers and waits for a configured grace period before forcibly killing any that have not exited, allowing applications to finish in-flight work and close connections cleanly.
PreStop Hooks
A preStop hook can be configured to run a specific action immediately before the termination signal is sent, commonly used to deregister the Pod from external systems or drain connections before shutdown begins.
Lifecycle Diagram
Together, phases, conditions, container states, and probes give Kubernetes fine-grained, continuously updated visibility into whether a Pod is not just running, but actually healthy and ready to do useful work.
Content in this section
- 9.1 Kubernetes Pod Lifecycle Scope
- 9.2 Kubernetes Pod Creation Lifecycle
- 9.3 Kubernetes Pod Scheduling Lifecycle
- 9.4 Kubernetes Pod Node Handoff
- 9.5 Kubernetes Pod Startup Lifecycle
- 9.6 Kubernetes Pod Phase Progression
- 9.7 Kubernetes Container State Progression
- 9.8 Kubernetes Init Container Lifecycle
- 9.9 Kubernetes Application Container Lifecycle
- 9.10 Kubernetes Container Restart Behavior
- 9.11 Kubernetes Pod Condition Lifecycle
- 9.12 Kubernetes Container Health Probe Flow
- 9.13 Kubernetes Liveness Probe Behavior
- 9.14 Kubernetes Readiness Probe Behavior
- 9.15 Kubernetes Startup Probe Behavior
- 9.16 Kubernetes Probe Handler Types
- 9.17 Kubernetes Readiness Gate Behavior
- 9.18 Kubernetes Pod Termination Lifecycle
- 9.19 Kubernetes Container Lifecycle Hooks
- 9.20 Kubernetes Pod Endpoint Lifecycle
- 9.21 Kubernetes Pod Replacement Lifecycle
- 9.22 Kubernetes Pod Lifecycle Boundary