Drain Day Scenario
Run one controlled node drain rehearsal and compare outcomes:
- Healthy HPA + PDB: The drain proceeds smoothly with bounded disruption; HPA adds more replicas if necessary.
- Restrictive PDB: The drain blocks (expected protective behavior) because the service is at its minimum replica count.
- Low Replica Baseline: Higher user-facing risk and slower recovery during the drain.
Objective: Confirm expected behavior before a real, high-stakes maintenance event.
Core Exercises (Required)
- Verify HPA: Use
kubectl get hpa -n developto see the scaling status and utilization targets. - Check PDB: Use
kubectl get pdb -n developto see the current allowed disruptions. - Simulate Load: Use a simple
aborheyscript to generate traffic and observe the HPA adding replicas. - Debug a Blocked Drain: Set
minAvailablein your PDB equal to your current replica count. Try to drain the node and document how Kubernetes prevents the disruption.
Challenge Exercise (Optional)
Drain During Rolling Update: Simulate a node drain during an active rolling update and verify that PDB constraints prevent service disruption. Document the exact sequence of pod evictions and replacements.
Done When
You have completed this chapter when:
- You can verify HPA targets, current bounds, and current scaling state.
- You can verify PDB allowed disruptions before a node drain.
- You can explain the interaction between HPA, PDB, rollout, and drain.
- You understand why
minReplicas: 2is a reliability requirement for production.
Knowledge Check
Before finishing this chapter, complete the Quiz to verify your understanding of the guardrail principles.