Running workloadsLesson 5 of 14
When a Pod Dies (Self-Healing)
When the desired state and the actual state drift apart, Kubernetes brings them back in line on its own. Let's see who revives what, and how, when one container dies and when a whole node stops.
node-1 statusReady
app-a restarts0
Ready / desired2 / 2
RequestResponse / reportWatchAppears in a later step
What you will learn
- A dead container is restarted by the kubelet on the same node
- CrashLoopBackOff means "waiting to retry"
- When a node stops, controllers recreate pods on another node
- Each kind of self-healing takes a different amount of time
Self-healing by failure level
| What stopped | Who revives it | Result | Time taken |
|---|---|---|---|
| Container | That node's kubelet | Container restarts inside the same pod | Seconds (up to 5 min apart if repeated) |
| Node | Controllers + scheduler | New pod created on another node | Minutes (includes the default 5 min wait) |
| Pod deleted manually | ReplicaSet controller | New pod created | Seconds |
Try it yourself
kubectl get pods -o wide # RESTARTS and node per Pod
kubectl logs <pod> --previous # Logs from the last run
kubectl describe pod <pod> # Last State and Back-off events
kubectl get nodes # NotReady nodes
kubectl get pod <pod> -o jsonpath='{.spec.tolerations}' # not-ready wait (300s by default)
Check yourself
Further reading: Pod Lifecycle · Configure Liveness, Readiness and Startup Probes