Liveness probe did not respond within timeoutSeconds
Production Risk
Unnecessary container restarts during peak traffic cause brief service interruptions.
A liveness probe timeout occurs when the probe (HTTP, TCP, or exec) does not complete within the configured timeoutSeconds. Kubernetes counts this as a probe failure. If timeouts occur consecutively beyond failureThreshold, the container is killed. Timeouts often indicate a temporarily overloaded application rather than a true deadlock.
- 1Application is under heavy load and the health endpoint response is slow
- 2timeoutSeconds configured too low (default is 1 second, often too tight)
- 3Health endpoint performs expensive operations (DB queries) that slow under load
- 4Network or DNS delay on the node causing HTTP probe latency
Container restarts with events showing probe timeout; often correlated with high CPU or load spikes.
kubectl describe pod mypod | grep -A 5 "Events:" # Warning Unhealthy kubelet Liveness probe failed: (Timeout exceeded while awaiting headers) kubectl describe pod mypod | grep -A 10 "Liveness:"
expected output
Warning Unhealthy ... Liveness probe failed: (Timeout exceeded while awaiting headers)
Fix 1
Increase timeoutSeconds and failureThreshold
WHEN Application is healthy but slow under load
livenessProbe:
httpGet:
path: /healthz
port: 8080
timeoutSeconds: 10 # Increase from default 1s
failureThreshold: 5
periodSeconds: 20Why this works
Larger timeout gives the application more time to respond before the probe is counted as failed.
Fix 2
Make the health endpoint lightweight
WHEN Health endpoint is too expensive
# Health endpoint should return immediately without querying databases # Example: just return 200 OK if the server is running # Move deep health checks to a separate /ready endpoint
Why this works
A fast-returning health endpoint prevents timeouts during load spikes.
Kubernetes Documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev