DevOpsil
KubernetesHigh

Fix: Kubernetes HPA Not Scaling Pods

HPA shows <unknown> for current metrics

!Symptoms

  • HPA shows <unknown> for current metrics
  • Pod count stays at minReplicas despite high load
  • kubectl get hpa shows TARGETS as <unknown>/80%
  • Application response times increasing under load

?Root Causes

  • metrics-server not installed or not running in the cluster
  • Pod resource requests not set — HPA cannot calculate utilization without requests
  • Custom metrics adapter not configured for custom metric targets
  • RBAC permissions missing for metrics-server to read pod metrics
  • HPA stabilization window preventing rapid scale-up

#Diagnosis Steps

  1. 1Run `kubectl get hpa` and check if TARGETS shows <unknown>
  2. 2Run `kubectl top pods` — if it fails, metrics-server is not working
  3. 3Verify metrics-server is running: `kubectl get pods -n kube-system | grep metrics-server`
  4. 4Check pod spec has resource requests defined: `kubectl get pod <pod> -o yaml | grep requests`
  5. 5Run `kubectl describe hpa <name>` and check conditions/events for errors

>Fix

  1. 1Install metrics-server: `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`
  2. 2Add resource requests to your deployment: `resources: { requests: { cpu: '100m', memory: '128Mi' } }`
  3. 3For custom metrics, install prometheus-adapter or KEDA
  4. 4Fix RBAC: ensure metrics-server has proper ClusterRole bindings
  5. 5Reduce stabilization window: `behavior.scaleUp.stabilizationWindowSeconds: 0`

*Prevention

  • Always set resource requests on all containers — HPA requires them
  • Include metrics-server in cluster bootstrapping (Terraform/Helm)
  • Monitor HPA status in your dashboards alongside pod metrics
  • Load test with HPA configured before going to production
  • Set up alerts for HPA target unknown states

Related Error Messages

unable to get metrics for resource cpumissing request for cpufailed to get cpu utilizationno metrics returned from metrics-server