Troubleshooting guide
Kubernetes HPA not scaling: how to fix it
An HPA that refuses to scale nearly always cannot read its metric, or its calculation says no change is needed. Its status explains which.
3 min read10 sectionsUpdated
On this page
How it decides
About every 15 seconds, the HPA calculates desired = ceil(current replicas × current value / target value). It takes no action when the ratio is within a 10 percent tolerance. Utilisation is a percentage of the pod's CPU request, so a pod using a lot of CPU with a huge request may look idle.
# Current metrics, targets and replicas
kubectl get hpa my-app
# Conditions: AbleToScale, ScalingActive, ScalingLimited
kubectl describe hpa my-app | sed -n '/Conditions:/,$p'
# Is the metrics pipeline working?
kubectl top pods -l app=my-app
kubectl get apiservice v1beta1.metrics.k8s.io
# Requests on all containers
kubectl get deploy my-app -o jsonpath='{range .spec.template.spec.containers[*]}{.name}{" "}{.resources.requests}{"\n"}{end}'Fixes
Install or repair metrics-server. Set CPU requests for every container in the pod. Raise maxReplicas if you are hitting the limit. Base requests on real usage, so that the percentage means something. Scale on request rate or queue depth using an adapter when CPU does not track the load. Tune behavior.scaleDown.stabilizationWindowSeconds if scale-down is too slow for your needs.
When scaling is too late
An HPA reacts to what has already happened. Add metric lag, pod scheduling and application startup, and a sudden spike might not be served by new pods for a minute or more, longer if new nodes are needed. If traffic is spiky, keep a higher minimum, lower the target so that headroom exists, or scale ahead of known events. Readiness also matters: pods that report ready before they can handle traffic cause errors during the very moment you scaled up to prevent them. See the HPA guide for more detail.
Catch it automatically
Alert when an HPA is at its maximum for a sustained period, and when its metrics are unavailable. Kubernetes monitoring charts replicas against load, and APM shows if latency rose during the scale-up.
Why does my HPA show unknown?
The metric cannot be read. Check metrics-server and CPU requests.
Why does it not scale down?
A five-minute stabilization window applies by default.
Can HPA use memory?
Yes, but memory often does not fall after load drops, which can leave you over-scaled.
Related reading
- "DNS server not responding": how to fix it: Fix "DNS server not responding" on Windows and Mac: restart the router, flush DNS, switch to 1.1.1.1 or 8.8.8.8, and check adapters, VPNs and firewalls.
- Cloudflare error 520: web server returns an unknown error: Fix Cloudflare error 520 "Web server returns an unknown error": empty or reset origin responses, crashes, oversized headers and keep-alive mismatches.
- CreateContainerConfigError in Kubernetes: how to fix it: Fix Kubernetes CreateContainerConfigError: missing Secrets and ConfigMaps, wrong keys and namespaces, with kubectl commands that show exactly what is absent.
- Kubernetes node NotReady: how to diagnose and fix it: Fix a Kubernetes node stuck in NotReady: kubelet failures, memory or disk pressure, CNI problems and runtime crashes, with commands for node conditions.
- PostgreSQL connection refused: how to fix it: Fix PostgreSQL connection refused on port 5432: server not running, listen_addresses, pg_hba.conf, Docker hostnames and firewalls, with commands for every case.
- ERR_NAME_NOT_RESOLVED: how to fix DNS lookup failures: Fix ERR_NAME_NOT_RESOLVED: missing records, expired domains, broken resolvers and DNSSEC failures, with dig commands that show exactly where lookup fails.
Watch your own site and services with VitalRix
Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.