Autoscaling (HPA)
Instead of writing down a count, you write down a goal. The autoscaler samples the Pods' average utilisation and multiplies the current count by how far off the goal it is. The Pods it adds share the same load, which pulls utilisation back down — and that value becomes the input to the next decision. Count and metric pull on each other.
01Autoscaling (HPA)
Concept at a GlanceWhen load rose, a human used to edit the replica count. An autoscaler hands that job to a measurement.
The goal is 50% average CPU — not the exact number but a band around it. Inside the band, nothing happens.
Right now it sits below the band, yet three doesn't drop to two: the ratio works out to 2.04, and it always rounds up so as never to fall short.
Traffic surges and utilisation climbs well past the band. Three Pods can't keep up.
The needed count comes from the same formula: 80 over a goal of 50 is 1.6× of three — 4.8, rounded up to five.
The curve bends exactly where the count steps up. The moment the staircase rises is the moment utilisation starts falling.
46% is inside the band. Within the band it doesn't even compute — it simply holds.
As load drains away it scales back — but only after watching for a while, not right away.
However quiet it gets, it won't go below two. The staircase stops at the floor.
02 Understand It Simply
For EveryoneYou record a target metric, and the ratio against the current value determines how many pods are needed. Nothing moves inside the tolerance band around the target, and scaling down waits through a stabilization window.
The needed count is the current count × (current metric ÷ target metric), rounded up.
Scaling up reacts fairly quickly while scaling down waits out a stabilisation window — without it, a brief lull would make the count oscillate.
minReplicas and maxReplicas bound the range, and the metric doesn't have to be CPU: memory, custom, or external metrics such as queue depth work too.
This adds Pods rather than making one Pod bigger, which is what vertical scaling does.
- –Automatically expanding services with bursty traffic
- –picking a target utilisation and bounds
- –scaling on custom metrics like queue depth
- –and trading cost against headroom
03 Frequently Asked Questions
FAQWhat is Autoscaling (HPA)?+
Instead of writing down a count, you write down a goal. The autoscaler samples the Pods' average utilisation and multiplies the current count by how far off the goal it is. The Pods it adds share the same load, which pulls utilisation back down — and that value becomes the input to the next decision. Count and metric pull on each other.
Where is Autoscaling (HPA) used?+
Automatically expanding services with bursty traffic, picking a target utilisation and bounds, scaling on custom metrics like queue depth, and trading cost against headroom.
What's a simple analogy for Autoscaling (HPA)?+
You record a target metric, and the ratio against the current value determines how many pods are needed. Nothing moves inside the tolerance band around the target, and scaling down waits through a stabilization window.
