What are Kubernetes Probes (liveness, readiness, startup)?

Answer

Kubernetes uses probes to monitor container health and determine if a container is ready to serve traffic: (1) Liveness Probe: determines if the container is running. If it fails, Kubernetes kills and restarts the container. Use for: deadlocked processes that aren't crashing but not making progress. Don't use liveness probes too aggressively — if they fail during startup (before app is ready), it causes restart loops; (2) Readiness Probe: determines if the container is ready to accept traffic. If it fails, the pod is removed from Service endpoints (stops receiving traffic) but NOT restarted. Use for: dependencies not ready (database not connected), warming up caches, temporary unavailability; (3) Startup Probe: delays liveness and readiness probes until the container has started. Prevents premature liveness probe failures during slow startup. Runs until success — then hands off to liveness probe. Probe types: livenessProbe: httpGet: path: /health port: 8080 scheme: HTTP initialDelaySeconds: 30 periodSeconds: 10 failureThreshold: 3 timeoutSeconds: 5 readinessProbe: httpGet: path: /ready port: 8080 successThreshold: 1 startupProbe: httpGet: path: /startup port: 8080 failureThreshold: 30 periodSeconds: 10 # Allows 5 min for startup. Probe types: httpGet (HTTP/HTTPS), tcpSocket (TCP connection), exec (command in container, exit 0 = success), grpc. Best practices: readiness ≠ liveness — use different endpoints. Health endpoint should be fast (<100ms). Don't include dependencies in liveness (cascading restarts). Include database connectivity in readiness. Startup probe for slow-starting apps (avoid increasing initialDelaySeconds).