Kuberneteskuberneteshealth-checksprobesreliabilityproduction-ready
Liveness and Readiness Probes
Comprehensive health probe configuration for Kubernetes with startup probes, graceful shutdown, and probe-driven traffic management.
title: "Liveness and Readiness Probes" description: "Comprehensive health probe configuration for Kubernetes with startup probes, graceful shutdown, and probe-driven traffic management." category: "Kubernetes" language: "yaml" tags: ["kubernetes", "health-checks", "probes", "reliability", "production-ready"] createdAt: "2025-03-25" updatedAt: "2025-04-10"
Overview
Kubernetes probe configuration that distinguishes between startup delays, readiness for traffic, and liveness for deadlock detection. Combined with graceful shutdown and PodDisruptionBudgets, this ensures zero-downtime operations.
Code
startupProbe: # Am I done starting? (checked first)
failureThreshold: 30
periodSeconds: 2
readinessProbe: # Can I receive traffic? (ongoing)
successThreshold: 2
failureThreshold: 3
livenessProbe: # Am I deadlocked? (restart if failing)
failureThreshold: 3Notes
- Startup probe prevents liveness probe from killing slow-starting containers (JVM, ML models)
- Readiness failure removes the pod from Service endpoints (traffic stops, no restart)
- Liveness failure triggers a container restart (use only for unrecoverable states like deadlocks)
preStopsleep gives ingress controllers time to remove the pod from their routing tablesterminationGracePeriodSecondsmust exceed preStop sleep + application drain time- PodDisruptionBudget prevents voluntary evictions (node drain) from taking all pods offline