Workloads & scheduling
Deployments, StatefulSets, requests/limits, affinity, PodDisruptionBudgets. Why OOMKilled happens and how to stop it.
The mental model
Kubernetes is a matchmaking service between work that wants to run (Pods) and machines with capacity (Nodes). You never place a pod on a node yourself. You describe what you want, and a control loop keeps reality converging on that description.
The analogy that sticks: an airline seating system. A **Pod** is a passenger group that must sit together (containers sharing a network namespace and volumes — they always fly on the same plane). A **Deployment** is a standing booking: "always keep 10 of these groups in the air, and when I change the meal preference, swap them out a few at a time." The **scheduler** is the seat-assignment algorithm; requests are the seat width you reserved, limits are how far you may spill into the aisle before crew intervene. Affinity rules are "seat these two together" or "never put all of them on one plane." A PodDisruptionBudget is the union contract: "you may not deplane more than one crew member at a time, even for maintenance."
The one idea that explains most confusion: **requests are for the scheduler, limits are for the kernel.** The scheduler only does arithmetic on requests when deciding whether a pod fits on a node — it never looks at limits or at actual usage. Once running, the container runtime enforces limits: CPU by throttling, memory by killing. A pod with requests far below real usage will be scheduled onto a node that cannot actually feed it.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision