DevOps and cloud / Intermediate / 6 min / Updated
Kubernetes: scheduling pods and self-healing
Place pods on nodes by CPU request, then kill a node. Spread or bin-pack, Pending pods and failure detection decide how much capacity you lose.
Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.
In short
What is kubernetes?
Kubernetes runs containers as pods on a cluster of nodes; you declare how many replicas you want and controllers keep it that way.
Why does it matter?
Machines fail and load changes. A scheduler places pods by their CPU and memory requests, and controllers replace pods that die.
What is the trade-off?
Bin-packing saves nodes but one failure takes out more pods; spreading costs more but limits the blast radius. Detection adds delay.
How do you explain it in an interview?
"A Deployment with resource requests, topology spread across nodes and zones, readiness probes, a PDB, and the HPA plus cluster autoscaler."
Check yourself
A pod requests 2 CPUs and no node has 2 CPUs free. What happens?
Answer: It stays Pending until room appears or a node is added. The scheduler only places a pod where its requests fit. The cluster autoscaler watches for Pending pods and adds nodes.
A node dies. Why are its pods not replaced right away?
Answer: The control plane first waits to be sure the node is gone, then evicts and recreates the pods. Missed heartbeats must pass a timeout before the node is NotReady, which avoids moving pods on a short network blip.
Why might you prefer spreading pods over bin-packing them?
Answer: One node failure then takes out fewer of your replicas. Bin-packing saves money but concentrates risk. Topology spread constraints and anti-affinity keep replicas apart.