How to fix Client.Timeout exceeded while awaiting headers in Kubernetes
Health check probes timeout because the container cannot respond within the configured timeoutSeconds (default 1 second). This occurs when the application is slow, under resource pressure, or implementing expensive health checks. Fix by increasing timeoutSeconds, allocating more resources, or using startup probes.
Quick fix
Fixes Client.Timeout exceeded while awaiting headers
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 5 # Increased from 1
periodSeconds: 10
failureThreshold: 3- Increase timeoutSeconds
- Allocate more CPU/memory resources
- Use startup probes for slow initialization
- Optimize health check endpoint
livenessProbe:httpGet:path: /healthport: 8080initialDelaySeconds: 30timeoutSeconds: 5 # Increased from 1periodSeconds: 10failureThreshold: 3Client.Timeout exceeded while awaiting headers
What this error means
Each health probe attempt has a timeout window (default 1 second). If the probe doesn't receive a response within that time, it fails. Repeated timeout failures trigger container restarts (liveness) or mark pod as not-ready (readiness). Timeouts indicate the application is either not responding, taking too long to respond, or the probe endpoint is expensive.
Typical symptoms
- Container repeatedly restarting with timeout-related failures
- Pod marked NotReady despite application being healthy
- Intermittent failures, especially under load
- Slowness apparent in probe response times
- Resource usage shows container under CPU/memory pressure
Common causes
- Default timeoutSeconds (1s) too short for application response time
- Application under CPU or memory pressure
- Health check endpoint doing expensive operations
- Network latency between kubelet and container port
- Application startup still in progress
How to fix "Client.Timeout exceeded while awaiting headers"
Raise from default 1 second to 5-10 seconds:
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
timeoutSeconds: 5 # Increased from 1
periodSeconds: 10
failureThreshold: 3Resource starvation causes slowness:
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 1000m
memory: 1GiMonitor usage:
kubectl top pod <pod-name> -n <namespace>Separate startup from liveness checks:
startupProbe:
httpGet:
path: /health
port: 8080
timeoutSeconds: 5
failureThreshold: 30
livenessProbe:
httpGet:
path: /health
port: 8080
timeoutSeconds: 3
failureThreshold: 3Ensure /health endpoint is lightweight. Avoid:
- Database queries
- External API calls
- Expensive computations
Instead, implement quick checks (memory available, basic connectivity).
Advanced notes
Timeout should be sufficient for expected response time + network latency. For HTTP probes, 3-5 seconds is typical. Test locally to determine appropriate timeout. Under sustained load, applications may need higher timeouts. If resource-constrained, allocate more or optimize health check logic.
Frequently asked questions
- What does "Client.Timeout exceeded while awaiting headers" mean?
- Each health probe attempt has a timeout window (default 1 second). If the probe doesn't receive a response within that time, it fails. Repeated timeout failures trigger container restarts (liveness) or mark pod as not-ready (readiness).
- How do I fix "Client.Timeout exceeded while awaiting headers"?
- Health check probes timeout because the container cannot respond within the configured timeoutSeconds (default 1 second). This occurs when the application is slow, under resource pressure, or implementing expensive health checks. Fix by increasing timeoutSeconds, allocating more resources, or using startup probes.
- What causes "Client.Timeout exceeded while awaiting headers"?
- Default timeoutSeconds (1s) too short for application response time Application under CPU or memory pressure Health check endpoint doing expensive operations
- Is the "Client.Timeout exceeded while awaiting headers" error serious?
- It is a medium-severity error โ more of a blocker than a risk. The steps above resolve it.
Official resources & further reading
- ๐Kubernetes Official Documentation
- ๐Kubernetes Docs: configure liveness readiness startup probes(Official Docs)
- ๐Kubernetes Docs: liveness readiness startup probes(Official Docs)
- ๐