Skip to content

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

Key points

  • <unknown> in targets means no metric.
  • CPU targets need CPU requests.
  • Utilisation is relative to requests, not to limits.
  • Scale-down waits five minutes by default.

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.

Common causes

  • metrics-server is missing or unhealthy.
  • No CPU requests on the containers in the pod, including sidecars.
  • At maxReplicas already.
  • Custom metric adapter not installed.
  • Requests set too high, keeping utilisation low.
  • Stabilization window delaying a scale-down.

Diagnose it

Read the conditions and events. They are explicit about what is wrong.

bash
# 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.

Frequently asked questions

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.

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.