The HPA is configured but pods don't scale even though the app is slow. Why?
BeginnerScenarioScaling and performance
Answer
Situation read → Either the HPA can't read metrics, or the metric it scales on isn't the one that's saturated.
What I'd do →
- Check the HPA status:
kubectl get hpa api -n prod
kubectl describe hpa api -n prod
- If targets show
<unknown>: metrics-server isn't running or pods have no CPU requests set (CPU utilisation is a percentage of requests). - If CPU is low but the app is slow: the bottleneck is elsewhere (DB, I/O, thread pool, downstream calls). Scaling on CPU won't help; scale on RPS or queue depth with KEDA or a custom metric, or fix the bottleneck.
- If it's at
maxReplicas: raise it, and check pending pods for cluster capacity. - Check
behaviorsettings; a long stabilisation window delays scale-up.
Why → HPA only scales on what you tell it. CPU-based scaling for an I/O-bound service never triggers.
Interview tip → "No requests set means no CPU-based HPA" is the quick win.
More on Scaling and performance
Traffic is expected to 10x for a sale next week. How do you prepare the platform?IntermediatePods are Pending during a traffic spike because the cluster is out of capacity. What do you do now and long term?IntermediateThe database CPU is at 95% and the API is timing out. What's your approach?Intermediate"Too many connections" errors from Postgres after scaling the app out. How do you fix it?IntermediateLatency is fine on average but p99 is terrible. Where do you look?AdvancedOne pod in a deployment is much slower than the others. How do you investigate?Beginner