Liveness & Readiness Probes

Health probes monitor container status in real-time, allowing Kubernetes to automatically restart crashed containers or remove un-ready pods from service endpoints.

1. Liveness vs Readiness vs Startup Probes

Probe TypeTrigger ActionWhen Fails
LivenessProbeChecks if the container application is alive & healthyKubernetes restarts the container automatically
ReadinessProbeChecks if the container is ready to accept user network trafficKubernetes removes the pod IP from Service endpoints
StartupProbeChecks if legacy slow-starting app initialization is completeDisables Liveness/Readiness probes until startup succeeds

2. Production Health Check Configuration Manifest

containers:
  - name: api-server
    image: my-api:latest
    ports:
      - containerPort: 3000

    # 1. Readiness Probe (Checks HTTP /health endpoint before sending traffic)
    readinessProbe:
      httpGet:
        path: /health
        port: 3000
      initialDelaySeconds: 5
      periodSeconds: 10

    # 2. Liveness Probe (Restarts container if deadlocked or unresponsive)
    livenessProbe:
      httpGet:
        path: /liveness
        port: 3000
      initialDelaySeconds: 15
      periodSeconds: 20
      failureThreshold: 3

Next Up

Learn Resource Limits & Management: CPU and Memory requests/limits, OOMKilled errors, and QoS classes.

Next Lesson: Resource Limits & CPU/RAM →