[Kubernetes Readiness Probe: Tutorial & Examples - Kubecost Blog](https://blog.kubecost.com/blog/kubernetes-readiness-probe/
Kubernetes Readiness Probe - Guide & Examples
π Configure Liveness, Readiness and Startup Probes | Kubernetes
Core Idea
Kubernetes probes decide a containerβs fate: liveness kills and restarts a stuck container, readiness only pulls it out of Service endpoints, and startup protects slow-booting apps until liveness takes over.
- Liveness fails on a deadlocked app that is still running; readiness fails while an app finishes initializing, removing it from endpoints without a restart; a startup probe disables liveness until it succeeds (e.g. JVM warm-up).
- Three check types: HTTP
httpGet, commandexec, andtcpSocket.- Timing knobs:
initialDelaySeconds,periodSeconds,timeoutSeconds,failureThreshold,successThreshold.
Health Probes
Health check simply ensure that the main process of your application is always running. If it isnβt , Kubernetes restarts it.
Liveness Probe
Checks if the application inside a container is still running.
If the liveness probe fails, K8s kills the container and restarts it.
Example: A deadlocked application that is running but not functioning properly.
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 3
periodSeconds: 10Readiness Probe
Checks if the container is ready to accept traffic,
If the readiness probe fails, the container is removed from the list of available endpoint, but it is not restared.
Example : An application that requires some time to initialize before it can handle requests.
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 10Startup Probe
Used to check if a container has successfully started.
If a startup probe is configured, the liveness probe is disabled until the startup probe succeeds.
Example : Applications with long startup times (e.g., a Java application that requires time for JVM warm-up).
startupProbe:
httpGet:
path: /start
port: 8080
failureThreshold: 30
periodSeconds: 10Other Types of Health Checks
- HTTP Request (
httpGet) β Kubernetes sends an HTTP request to a specified path. - Command Execution (
exec) β Kubernetes runs a command inside the container. - TCP Socket (
tcpSocket) β Kubernetes checks if a port is open.
Key Params
initialDelaySecondsβ Time to wait before the first probe.periodSecondsβ Frequency of health checks.timeoutSecondsβ Time before a probe times out.failureThresholdβ Number of failed attempts before the container is restarted.successThresholdβ Number of successful attempts before marking as healthy.
Healthchecks