☸️ The Liveness Probe That Punished the Pod for Working Hard
A liveness probe configured with a tight timeout and a low failure threshold assumes a healthy application always responds quickly – but a genuinely healthy app under real load can legitimately take longer to answer a health check request during a garbage collection pause, a cold cache warming up, or simply a busy moment handling real traffic. When the probe’s patience runs out before the app actually fails, kubelet kills a perfectly healthy pod and restarts it, which briefly makes things WORSE (a fresh pod has an even colder cache) and can repeat in a self-inflicted cycle that looks exactly like an application bug from the outside.
🔎 The Problem
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 1 # Very tight - one second to respond
failureThreshold: 1 # A SINGLE slow response kills the pod
# Under normal peak traffic, a brief GC pause or a moment of genuinely
# high CPU contention can push the health endpoint'"'"'s response time
# past one second - the app never actually stopped working, but the
# probe treats one slow reply, even once, as total failure and kubelet
# restarts the pod immediately.
✅ Fix: Give the Probe Room to Tolerate Real, Transient Slowness
- Raising failureThreshold above 1 (commonly 3 or higher) means a single slow response doesn’t trigger a restart – only a sustained run of failures does, which is a much better signal of the app actually being stuck rather than merely busy for a moment.
- A more generous timeoutSeconds, sized against the health endpoint’s actual observed response time under real peak load (not its response time when idle), stops the probe from timing out on responses that are slow but still well within a reasonable bound.
- Separating liveness (is the process fundamentally stuck, deadlocked, or crashed) from readiness (is the pod currently able to serve traffic well) lets a pod under temporary heavy load fail readiness – and get temporarily removed from the load balancer – without being killed and restarted outright by a liveness failure it didn’t actually deserve.
⚠️ Why This Is Easy to Configure Wrong From the Start
- Tight, aggressive probe settings look responsible when first configured – they seem to guarantee fast detection of a genuinely stuck pod – and they work fine in early testing under light load, which is exactly when nobody yet has the real-world response time data needed to size the thresholds correctly.
- The failure mode is easy to misdiagnose as an application performance bug, since the visible symptom (pods restarting under load) looks like the app itself can’t handle the traffic – checking pod restart events and their reason (a liveness probe failure specifically, versus an actual crash) is the fastest way to tell the two apart.
A liveness probe that can’t tell ‘stuck’ from ‘busy’ will eventually kill a pod for the crime of working exactly as hard as it’s supposed to.





