Interview Questions/Phone Screen/K8s Readiness vs Liveness Probes
IntermediatePhone
2 min

K8s Readiness vs Liveness Probes

KubernetesReliabilityTroubleshooting
Advertisement
Interview Question

What is the difference between readiness and liveness probes in Kubernetes?

Key Points to Cover
  • Readiness gates traffic until pod is ready; failing removes from endpoints
  • Liveness restarts the container when it gets unhealthy
  • Probes: HTTP/TCP/exec with initialDelay, period, thresholds
Evaluation Rubric
Explains readiness behavior34% weight
Explains liveness restart semantics33% weight
Mentions probe types and tuning33% weight
Hints
  • 💡A startup probe can protect slow apps from restarts.
Common Pitfalls to Avoid
  • ⚠️**Misusing probes:** Using a liveness probe to check for application readiness, leading to continuous restarts when the application is merely warming up.
  • ⚠️**Overly aggressive probe settings:** Setting `initialDelaySeconds` too low, or `periodSeconds` and `failureThreshold` too short, causing premature restarts or traffic removal for temporary issues.
  • ⚠️**Probes not reflecting true application health:** Checking only basic HTTP status codes (e.g., 200 OK) when the application might be running but functionally broken (e.g., unable to connect to a critical backend service).
  • ⚠️**Long-running Exec probes:** An `exec` command that takes too long to complete might exceed `timeoutSeconds` and be mistakenly considered a probe failure.
  • ⚠️**Not using both probes:** Relying solely on liveness or readiness, missing out on the complementary benefits for robust fault tolerance, such as isolating non-ready pods while gracefully restarting truly unhealthy ones.
Potential Follow-up Questions
  • When to use startup probes?
  • Common pitfalls causing restart loops?
Advertisement