Q: What is the difference between liveness and readiness probes? Give a scenario where each is important.
Liveness probe — "is this container still alive?" If it fails, Kubernetes restarts the container. Use for detecting deadlocks or infinite loops where the process is running but not making progress.
Want to master this scenario in a live sandbox? KodeKloud's CKA & CKAD Hands-On Certification Track covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "Kubernetes is a declarative desired state system; understanding the reconciliation loop is how you diagnose this quickly. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix."
Initial Diagnostics & Root Cause Analysis
Key: failed liveness = restart. Failed readiness = remove from load balancer rotation, but don't restart.
- Liveness probe — "is this container still alive?" If it fails, Kubernetes restarts the container. Use for detecting deadlocks or infinite loops where the process is running but not making progress.
- Scenario: A Java app has a thread deadlock. The JVM is running but requests hang forever. Liveness probe detects no HTTP response → restarts container.
- Readiness probe — "is this container ready to serve traffic?" If it fails, the pod is removed from Service endpoints. Use for apps that need warmup time or temporarily can't serve (e.g., during a DB connection retry).
Remediation & Permanent Safeguards
- Scenario: App just started and is loading a 5GB ML model. Readiness fails until load completes. No traffic is sent yet. App is not restarted (liveness probe is fine).
- Liveness probe — "is this container still alive?" If it fails, Kubernetes restarts the container....
- Scenario: A Java app has a thread deadlock. The JVM is running but requests hang forever. Livenes...
- Readiness probe — "is this container ready to serve traffic?" If it fails, the pod is removed fro...
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Enabling Horizontal Pod Autoscaler without defining baseline container CPU and memory requests HPA computes target metrics based on resource requests; omitting requests leaves HPA unable to calculate utilization percentages.
- Configuring restrictive container CPU limits that trigger severe CFS scheduler throttling Aggressive CPU limits throttle container execution cycles, causing unexpected p99 latency spikes even when total node CPU is underutilized.
- Leaving automountServiceAccountToken enabled by default on pods with no API interaction needs Automounting API tokens exposes internal cluster credentials to pods that have no operational requirement to interact with kube-apiserver.
-
Configuring StatefulSets using shared static PersistentVolumeClaims instead of volumeClaimTemplates in kubernetes-q052-what-is-the-difference-between-live
volumeClaimTemplatesguarantee dedicated independent storage volumes for each ordinal replica pod in stateful clusters.