kubernetes
autoscaling_error
ai_generated
true
failed to get cpu utilization: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API
ID: kubernetes/k8s-hpa-unable-to-fetch
88%Fix Rate
90%Confidence
55Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 8 | active | — | — | — |
Root Cause
HPA cannot fetch metrics because metrics-server is not installed, not healthy, or pods lack resource requests.
genericWorkarounds
-
92% success Install or fix metrics-server: kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
Check if metrics-server is running: kubectl get pods -n kube-system | grep metrics-server
Sources: https://kubernetes.io/docs/tasks/debug/debug-cluster/resource-metrics-pipeline/
-
90% success Ensure all target pods have resource requests defined
Add resources.requests.cpu and resources.requests.memory to pod spec containers
Sources: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
Dead Ends
Common approaches that don't work:
-
Manually scale replicas instead of using HPA
70% fail
Loses autoscaling capability — doesn't address the root cause
-
Switch to custom metrics without fixing resource metrics first
65% fail
Custom metrics require additional setup (Prometheus adapter) and are more complex
Error Chain
Leads to:
Frequently confused with: