Your HPA flaps between 5 and 20 replicas every few minutes. How do you stabilise it?
AdvancedScenarioResources, autoscaling and scheduling
Answer
Situation read → Oscillating replicas cause cold starts and cost.
What I'd do →
- Set
behavior.scaleDown.stabilizationWindowSeconds: 300 - Limit rate with
policies(for example 2 pods per 60s on scale down) - Use a more stable metric, for example averaged requests per second
- Fix slow startup with startup probes so new pods count correctly
- Review target utilisation
Why → Stabilisation windows make the HPA use the highest recommendation in the window, so it scales down slowly.
Interview tip → Mention autoscaling/v2 behavior field.
More on Resources, autoscaling and scheduling
How do you choose requests and limits for a new service?BeginnerPods are Pending with `0/6 nodes are available: 6 Insufficient cpu`. What do you do?IntermediateExplain QoS classes and which pods get evicted first.IntermediateCPU limits cause latency spikes though average usage is low. Why and what is the fix?IntermediateHow do you configure an HPA on CPU?BeginnerHPA shows `<unknown>/70%` for CPU. What do you do?Intermediate