Learn Labs
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.

eventno errorsclientsself-healsno humanrollout with preStop!✓rollout without preStop✗✓pod not ready✓✓container not alive✓✓memory over limit!✓node drained (PDB)✓✓node dies✗!StatefulSet node unavailable✗✗

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-0 stayed 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 happenedEffectFix
Default-deny NetworkPolicySelected the Gateway's own NGINX pod: every request hungAn explicit allow for the gateway pods
ScheduleAnyway spread + HPA scale-downA whole zone with no web podsDoNotSchedule with nodeTaintsPolicy: Honor
A bare pod on a nodekubectl drain refused to proceedRun everything under a controller
Removing replicas from an applied DeploymentDropped to 1 replica until the HPA noticedRemove it in a quiet moment, or with server-side apply
kubectl 1.33 against a 1.37 clusterUnsupported version skewMatch kubectl to the cluster (±1 minor)
ConfigMap editedRunning pods kept the old valuesRoll the Deployment, or hash ConfigMap names
The Gateway's NGINX podBestEffort QoS: evicted first under memory pressureRequests via NginxProxy, a PriorityClass

Lab

  1. Reproduce each row of the table, and for each, write the first signal (alert, metric, event) that would have shown it in production.
  2. Stop two worker nodes at once. Which pods survive, and does the PDB matter? (It doesn't, for involuntary failures. Why?)
  3. Delete CoreDNS's pods (kubectl -n kube-system delete pod -l k8s-app=kube-dns) while running traffic. What breaks, and for how long?

On this page