QA
Intermediate LevelDocker & Deployment

What is the difference between Liveness, Readiness, and Startup Probes in Kubernetes?

❓ Interview Prompt: Explain Kubernetes probe types — liveness (restart trigger), readiness (traffic gate), startup (slow-boot grace) — with HTTP/TCP/exec probe configurations.

Kubernetes uses three types of probes to determine container health and traffic eligibility:

1. Liveness Probe — "Is the app alive?":

•
Purpose: Detects if the application is deadlocked or in a fatal state.
•
Action on failure: Kubernetes kills and restarts the container (respecting restart policy).
•
Risk: A misconfigured liveness probe causes restart loops. Only probe for truly fatal conditions.

2. Readiness Probe — "Is the app ready for traffic?":

•
Purpose: Determines if the Pod should receive traffic from a Service.
•
Action on failure: Pod is removed from Service endpoints (no traffic) but NOT restarted.
•
Use case: Exclude a Pod from load balancing during startup, configuration reloads, or temporary overload.

3. Startup Probe — "Is the app done starting?":

•
Purpose: Disables liveness/readiness probes during slow application startup to prevent premature restarts.
•
Action on failure (after timeout): Kills container (liveness takes over).
•
Use case: Legacy apps or JVM services that take 60–120 seconds to start.

Code Implementation Example

yaml
spec:
  containers:
    - name: api
      image: myapp:v1.2.3
      
      # Startup Probe: disable other probes for up to 5min (60 * 5s)
      startupProbe:
        httpGet:
          path: /health
          port: 3000
        failureThreshold: 60    # allow up to 60 failures
        periodSeconds: 5        # check every 5s = 5min grace

      # Liveness Probe: restart if deadlocked
      livenessProbe:
        httpGet:
          path: /health/live    # 200 = alive
          port: 3000
        initialDelaySeconds: 0  # startup probe handles grace
        periodSeconds: 10
        failureThreshold: 3     # restart after 3 consecutive failures

      # Readiness Probe: gate traffic eligibility
      readinessProbe:
        httpGet:
          path: /health/ready   # 200 = ready to serve traffic
          port: 3000
        periodSeconds: 5
        failureThreshold: 3     # remove from endpoints after 3 failures
💡Three distinct probes: startup disables liveness during boot; liveness restarts deadlocked pods; readiness gates Service endpoint membership.
🎯 Interview Key Takeaway

Startup → Liveness → Readiness: use startup for slow boots, liveness for deadlock detection (restarts), readiness for traffic gating (no restart). Never confuse them.

#Kubernetes#Liveness#Readiness#Startup Probes#Health Checks#Intermediate
Back to all Docker & Deployment Questions→

More Docker & Deployment Interview Questions

Beginner LevelDocker & Deployment

How do Docker Multi-Stage Builds minimize image size and improve security?

Beginner LevelDocker & Deployment

What is the difference between a Docker Container and a Virtual Machine (VM)?

Beginner LevelDocker & Deployment

What is the difference between a Docker Image and a Docker Container?