Pod Lifecycle
Pods go through several phases during their lifetime. Understanding the Pod lifecycle helps you debug issues and design reliable applications.
Pod Phases
The Pod’s
status.phase field shows one of these values:- Pending: Pod accepted, but containers not yet running (e.g., image pull in progress).
- Running: Pod bound to a node and at least one container is running.
- Succeeded: All containers terminated successfully (for run‑to‑completion pods).
- Failed: At least one container terminated with failure.
- Unknown: Pod state cannot be determined.
Container States
Each container within a Pod has its own state:
- Waiting: Container not yet started (e.g., pulling image).
- Running: Container is executing.
- Terminated: Container completed or failed.
kubectl describe pod.Restart Policies
Pods have a
restartPolicy that controls container restarts:- Always (default): Restart container always (used for long‑running apps).
- OnFailure: Restart only on failure.
- Never: Never restart.
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
restartPolicy: OnFailure
containers:
- name: busybox
image: busybox
command: ["sh", "-c", "exit 1"]This container will exit with failure, and the Pod will restart it.Pod Conditions
Additional statuses like
PodScheduled, ContainersReady, Initialized help track readiness. Use kubectl get pod -o yaml to see conditions.Two Minute Drill
- Pod phases: Pending, Running, Succeeded, Failed, Unknown.
- Container states: Waiting, Running, Terminated.
- Restart policies: Always, OnFailure, Never.
- Use
kubectl describe podto see detailed status.
Need more clarification?
Drop us an email at career@quipoinfotech.com
