Skip to content

Troubleshooting · Kubernetes

Kubernetes HPA not scaling down? 6 causes, ranked

6 causes, most common first · last reviewed

TL;DR

Usually nothing is broken: the HPA waits out a five-minute scale-down stabilisation window by default and acts on the highest recommendation in it. If replicas stay high long after that, run kubectl describe hpa and read the conditions and current metric values; one metric still above target, often memory, keeps the replica count up.

On this page

Quick triage: the first five minutes

  1. Read the HPA's conditions and recent events. They usually say why it is holding.

    Shell
    kubectl describe hpa checkout -n shop
    AbleToScale with reason ScaleDownStabilized means it is waiting out the window. ScalingActive False means it cannot read metrics.
  2. Compare every current metric value with its target. The HPA uses whichever metric asks for the most replicas.

    Shell
    kubectl get hpa checkout -n shop -o jsonpath='{.status.currentMetrics}' ; echo
    kubectl get hpa checkout -n shop -o jsonpath='{.spec.metrics}' ; echo
  3. Check what else sets the replica count: minReplicas, and any pipeline or GitOps tool that writes spec.replicas on the Deployment.

    Shell
    kubectl get hpa checkout -n shop -o jsonpath='{.spec.minReplicas}' ; echo
    kubectl get deploy checkout -n shop -o jsonpath='{.spec.replicas}' ; echo

The causes, ranked

Most common first. The ranking is a judgement from how these failures usually turn out, not a measured statistic.

Most common

1. It is waiting out the scale-down stabilisation window

What it looks like

  • Load dropped a few minutes ago and replicas have not moved yet.
  • kubectl describe hpa shows AbleToScale True with reason ScaleDownStabilized: recent recommendations were higher than the current one.
  • Replicas fall in steps several minutes after the drop, then settle.

How to confirm it

With no behavior block, scale-down uses a 300-second stabilisation window: the controller remembers its recommendations over that window and applies the highest. Scale-up has no window by default, which is why scaling up feels instant and scaling down feels stuck.

Fix it now

If five minutes is too cautious for this workload, shorten the window and set a policy for how fast replicas may be removed. Keep some window: without one, short dips in load make the replica count flap, and every flap means pods starting, warming caches and joining load balancers again, which costs more than a few idle minutes.

YAML
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
spec:
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 120
      policies:
        - type: Percent
          value: 50
          periodSeconds: 60
      selectPolicy: Max
Removes at most half the replicas per minute, after two minutes of lower recommendations.

Prevent it

Set behavior explicitly in every HPA so the scale-down speed is a reviewed decision rather than a default nobody remembers.

Most common

2. Another metric is still above its target

What it looks like

  • CPU fell well below target, but replicas stay up.
  • The HPA has more than one metric, commonly CPU and memory.
  • Memory per pod stays flat after load drops, typical of a JVM, which rarely hands heap back to the operating system.

How to confirm it

With several metrics, the HPA computes a replica count for each and takes the largest. Read status.currentMetrics against spec.metrics: the one at or above target is the one holding the count up.

Fix it now

Remove memory as a scaling metric for runtimes that keep their heap, or raise its target to a level the pods reach only under real load. Scale on the signal that tracks load: CPU, requests per second, or queue depth. If you scale on a custom or external metric, check that it really returns to a low value when the work is done; a queue-length metric that reports a stale or non-zero floor keeps replicas up indefinitely.

Prevent it

Before adding a metric to an HPA, check that it falls when load falls. A metric that only ever goes up gives you an autoscaler that only ever goes up.

Common

3. The maths keeps the count where it is

What it looks like

  • Utilisation hovers just under the target, and the HPA does nothing.
  • CPU requests are set low, so modest real usage shows as a high percentage.
  • Replicas drop by one and then stop, with utilisation close to target.

How to confirm it

The controller computes desired replicas as ceil(current replicas × current value ÷ target), and ignores changes while the ratio is within a tolerance (0.1 by default, set by --horizontal-pod-autoscaler-tolerance on the controller manager). Utilisation is usage divided by the pod's request, so the request you set decides what the percentage means.

Shell
kubectl top pods -n shop -l app=checkout
kubectl get deploy checkout -n shop \
  -o jsonpath='{.spec.template.spec.containers[*].resources.requests}' ; echo
Divide usage by the request yourself and compare with the target.

Fix it now

Set CPU requests from observed usage at normal load, then choose a utilisation target that leaves headroom. Rounding up is by design; it is why a deployment at the edge of a target keeps one extra pod. Note that a change to requests changes every utilisation reading at once, so adjust the target in the same change.

Prevent it

Review requests when the application changes; a target is only meaningful against a request that reflects real usage.

Common

4. Something else holds the replica count up

What it looks like

  • Replicas never go below a particular number, whatever the load.
  • The count jumps back up shortly after every deploy.
  • kubectl describe hpa shows ScalingLimited with reason TooFewReplicas.

How to confirm it

minReplicas is a hard floor. Separately, if the Deployment manifest you apply still contains spec.replicas, every apply resets the count and the HPA has to scale down again from there.

Fix it now

Lower minReplicas to the true minimum you need for availability. Remove spec.replicas from manifests for HPA-managed Deployments, or tell your GitOps tool to ignore that field.

Prevent it

Make the HPA the single owner of the replica count, and document the reason for minReplicas next to it.

Less common

5. Metrics are missing for some pods, or for all of them

What it looks like

  • ScalingActive is False with a reason such as FailedGetResourceMetric, and events report that it was unable to get metrics.
  • kubectl top pods fails or shows only some pods.
  • Pods that are starting or not ready are part of the deployment.

How to confirm it

Check that the metrics API is served. When metrics are missing for some pods, the controller is conservative: for a scale-down it assumes those pods are using 100% of the target, which can cancel the scale-down. If it cannot get metrics at all, it does not scale.

Shell
kubectl get apiservice v1beta1.metrics.k8s.io
kubectl get --raw /apis/metrics.k8s.io/v1beta1/namespaces/shop/pods | head -c 600 ; echo
AVAILABLE should be True. For custom or external metrics, check the adapter that serves them.

Fix it now

Fix metrics-server or the metrics adapter first; no HPA setting helps while metrics are missing. Then look for pods that never become ready or crash-loop, since they distort the calculation. A deployment with a few permanently broken pods can sit above its true need for as long as those pods exist.

Prevent it

Alert on HPA conditions, not just on replica counts: ScalingActive False is an outage of your autoscaling even when the app looks fine.

Rare but nasty

6. Scale-down is restricted or switched off

What it looks like

  • Replicas never decrease, even after long quiet periods, while scale-up works.
  • The HPA has a behavior block someone added during an incident.
  • Replicas decrease by one pod at long intervals.

How to confirm it

Read spec.behavior.scaleDown. selectPolicy: Disabled turns scale-down off entirely. A policy of one pod per long period makes it crawl, and selectPolicy: Min picks the most restrictive of several policies.

Shell
kubectl get hpa checkout -n shop -o jsonpath='{.spec.behavior.scaleDown}' ; echo

Fix it now

Restore a scale-down policy that matches how fast you are happy to lose capacity, and remove Disabled if it was a temporary measure.

Prevent it

Put temporary autoscaling overrides on a ticket with an expiry, and review behavior blocks in code review like any other production setting.

Related concepts

FAQ

How long does the HPA take to scale down?

With default behavior, at least five minutes after load drops, because of the 300-second scale-down stabilisation window. After that, the default policy allows removing all surplus pods at once, down to minReplicas.

Why does HPA scale up quickly but scale down slowly?

Scale-up has no stabilisation window by default and scale-down has five minutes. This is deliberate: adding capacity late hurts users, while removing it late only costs money.

How do I make the HPA scale down faster?

Set spec.behavior.scaleDown.stabilizationWindowSeconds lower and add a policy limiting how many pods or what percentage can go per period. Check first that no other metric or minReplicas is holding the count.

Should an HPA scale on memory?

Only if memory use falls when load falls. Many runtimes, including the JVM, keep memory they have allocated, so a memory metric can stop the HPA from ever scaling down.

All troubleshooting guides

Reference documentation: Kubernetes documentation: Horizontal Pod Autoscaling ↗ · Kubernetes API reference: HorizontalPodAutoscaler (autoscaling/v2) ↗ · Report a problem

Commands and settings are checked against the documentation linked above. Defaults change between versions; check the documentation for the version you run.