Walk me through a pod's lifecycle. Why do we need readiness AND liveness probes?
Any Kubernetes-touching role asks this. Probes are where most real production bugs live — interviewers probe for real experience.
Phases: Pending (scheduled, pulling images), Running (all containers started), Succeeded (all exited 0), Failed (some container failed non-zero), Unknown.
Init containers run to completion before app containers start. Great for migrations, config fetching, setup.
Liveness probe: "is the process alive?" — fail kills the container. Use only for deadlock detection. Too aggressive = crash loop.
Readiness probe: "is the process ready to serve?" — fail removes from Service endpoints. Use during warmup, degraded states, dependency loss.
Startup probe: for slow-starting apps. Disables liveness until it passes, then liveness takes over.
A pod goes Pending (waiting to schedule + pull images) → Running (containers up) → Succeeded or Failed. Init containers run to completion first — good for migrations and config fetch. The two probes solve different problems and both matter. Liveness answers 'is the process hung?' — if it fails, Kubernetes kills the container. Use it for genuine deadlocks only; overly aggressive liveness is how you crash-loop production. Readiness answers 'should I send traffic to this pod?' — failure removes the pod from the Service endpoint set without killing it. This is what you want during warmup, during dependency outages, or when the pod is temporarily degraded. For apps with long startup (JVM, ML models), add a startup probe so liveness doesn't fire before the app is even up. For graceful shutdown: SIGTERM → preStop hook → drain connections → exit. If your app exits faster than load balancers notice, you drop requests — preStop sleep is the common fix.
Readiness should check dependencies (DB, cache). Liveness should NOT — it'll take down healthy pods when an upstream blips.
terminationGracePeriodSeconds + preStop sleep covers most "dropped requests on rolling deploy" issues.
HireMe AI (即答侠) pairs each probe with a failure mode — interviewers like to hear "I've been burned by this".
Yes if your app doesn't deadlock. Many teams run only readiness — safer default than over-aggressive liveness.
Startup probe is the modern answer — waits for success, then liveness runs. initialDelaySeconds requires guessing startup time.
HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.
Try HireMe AI Free