Operations
Failure Scenarios
How a Kubernetes deployment breaks, measured in this lab
Kubernetes heals a lot on its own. The scenarios that hurt are the ones where it heals slowly, can't heal at all, or causes the problem. Every row here comes from this module's labs or from building them.
What each event did (! = briefly, or partly)
Heals by itself, no client impact
- A pod goes unready: out of endpoints in about 2 s, back in under 1 s once ready again.
- A container hangs (liveness): restarted in 16 to 20 s, no errors, because readiness and the other replicas covered it.
- Memory over the limit: OOMKilled (exit 137) and restarted. The request in flight failed; repeated kills become CrashLoopBackOff.
- Node drains: two at once, zero errors, paced by the PDB.
Heals, but clients notice
- Rolling updates without a preStop sleep: 2 to 3 requests hung for 5 s per rollout while proxies caught up with endpoint changes.
- Gateway reloads: with the sleep, 0 to 1 errors per rollout, from reload races on keepalive connections.
- A node dies: 45 s of requests to a dead pod (7 timeouts), then 5 minutes on two of three replicas before the pod was replaced.
Doesn't heal without you
- A stateful pod's node is unavailable:
redis-0stayed Pending because its local volume lived on that node. Every request needing Redis got 503. - Pods left in one zone after a drain: uncordoning doesn't rebalance; one more failure there takes the app down.
Self-inflicted, found while building this module
| What happened | Effect | Fix |
|---|---|---|
| Default-deny NetworkPolicy | Selected the Gateway's own NGINX pod: every request hung | An explicit allow for the gateway pods |
ScheduleAnyway spread + HPA scale-down | A whole zone with no web pods | DoNotSchedule with nodeTaintsPolicy: Honor |
| A bare pod on a node | kubectl drain refused to proceed | Run everything under a controller |
Removing replicas from an applied Deployment | Dropped to 1 replica until the HPA noticed | Remove it in a quiet moment, or with server-side apply |
| kubectl 1.33 against a 1.37 cluster | Unsupported version skew | Match kubectl to the cluster (±1 minor) |
| ConfigMap edited | Running pods kept the old values | Roll the Deployment, or hash ConfigMap names |
| The Gateway's NGINX pod | BestEffort QoS: evicted first under memory pressure | Requests via NginxProxy, a PriorityClass |
Production note
Most of these were silent. Nothing logged an error when the zone emptied, when the Gateway pod became BestEffort, or when the Deployment dropped to one replica. Only a lab, a dashboard, or an incident shows them. Drill rollouts, drains and node failures regularly, against production-like traffic, and look at what clients saw.
Lab
- Reproduce each row of the table, and for each, write the first signal (alert, metric, event) that would have shown it in production.
- Stop two worker nodes at once. Which pods survive, and does the PDB matter? (It doesn't, for involuntary failures. Why?)
- Delete CoreDNS's pods (
kubectl -n kube-system delete pod -l k8s-app=kube-dns) while running traffic. What breaks, and for how long?