DevOps, SRE & Cloud Interview · Containers & Kubernetes · Lesson 3 of 3
Scaling, health & scheduling
Kubernetes keeps apps healthy and right-sized through probes, resource requests/limits, and autoscalers.
- Liveness probe: is the container alive? If it fails, Kubernetes restarts the pod.
- Readiness probe: is it ready to serve? If it fails, the pod is pulled out of the Service (no traffic) but not restarted — key during startup and warmup.
- Requests vs limits: requests reserve capacity for scheduling; limits cap usage. Exceeding a memory limit gets the container OOM-killed; CPU over the limit is throttled.
- HPA (Horizontal Pod Autoscaler): add/remove pod replicas based on CPU or custom metrics — or event-driven scalers (KEDA) for queue-length workloads. Cluster Autoscaler: add/remove nodes when pods cannot be scheduled.
Liveness vs readiness confusionA classic mistake: using a liveness probe for slow startup. A slow-but-healthy app fails liveness and gets restarted forever (crash loop). Use a readiness probe (or a startup probe) for warmup — it withholds traffic without killing the pod.
◆ Lock it in
- Liveness = restart if dead; readiness = withhold traffic until ready (do not confuse them).
- Requests schedule the pod; limits cap it — over-limit memory is OOM-killed, CPU is throttled.
- HPA scales pods; Cluster Autoscaler scales nodes.
Feynman drill — say it out loudExplain the difference between a liveness and a readiness probe, and what breaks if you swap them.
Step 1 rate your confidence · Step 2 pick your answer
A pod is slow to start but healthy. Which probe should gate traffic during warmup?
Step 1 — how sure are you?