❤️ Is Your App Alive AND Ready?
Liveness = restart if dead. Readiness = don’t send traffic until ready. Startup = extra time for slow-starting apps. Use all three for reliability.
📝 Probe Configuration
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 3
startupProbe:
httpGet:
path: /healthz
port: 8080
failureThreshold: 30
periodSeconds: 10
🎯 Probe Types
// HTTP Probe (most common)
livenessProbe:
httpGet:
path: /health
port: 8080
httpHeaders:
- name: Custom-Header
value: Awesome
// TCP Probe (for databases, Redis)
readinessProbe:
tcpSocket:
port: 3306
// Command Probe (exec)
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
💡 Best Practices
- Liveness: check only essential internal state (no dependencies)
- Readiness: check database, cache, external APIs
- Startup: for apps with long startup time (Java, Node.js large apps)
- Set failureThreshold to 3 (avoid flapping)
- Don’t use same endpoint for liveness and readiness
“App kept restarting because database was slow to respond. Fixed: moved DB check to readiness probe only. Liveness probe only checks process health. Deployments now stable.”
