Explain liveness, readiness, and startup probes.
Probes let Kubernetes decide a container's health and readiness.
- readinessProbe: whether the Pod should receive traffic. Failing it removes the Pod from Service endpoints but does not restart it. Use it while warming up or when a dependency is down.
- livenessProbe: whether the container is alive. Failing it restarts the container. Use it to recover from deadlocks, not for dependency failures.
- startupProbe: gives slow-starting apps time to boot. Until it succeeds, liveness and readiness are disabled, preventing restart loops.
livenessProbe:
httpGet: {path: /healthz, port: 8080}
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet: {path: /ready, port: 8080}
Set realistic thresholds. An aggressive liveness probe causes cascading restarts, and a missing readiness probe sends traffic to unready Pods. Prefer HTTP checks that test real dependencies.