Middle+
What are readiness, liveness, and startup probes?
sobes.tech AI
Answer from AI
Readiness, liveness, and startup probes are mechanisms for checking the application's state, often used in Kubernetes to manage the lifecycle of containers.
-
Readiness probe: Checks if the application is ready to accept traffic. If the probe fails, Kubernetes does not send traffic to this pod.
-
Liveness probe: Checks if the application is alive and not hung. If the probe fails, Kubernetes restarts the container.
-
Startup probe: Used to verify the successful start of the application. It allows setting a longer timeout for startup to avoid premature container restarts.
Example:
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
startupProbe:
httpGet:
path: /startup
port: 8080
failureThreshold: 30
periodSeconds: 10
Thus, these probes help Kubernetes efficiently manage the application's state and ensure its stable operation.