error: Metrics API not available / HPA: unable to get metrics for resource cpu
metrics-server isn’t installed or isn’t working, so kubectl top and CPU/memory HorizontalPodAutoscalers have no data.
Seen on:
Kubernetes
Meaning
kubectl top and resource-based HPAs read the metrics.k8s.io API served by metrics-server. HPAs then show <unknown>/50% and FailedGetResourceMetric. On kind/minikube/self-signed kubelets, metrics-server often needs --kubelet-insecure-tls; pods also need CPU requests for percentage targets.
Common causes
- metrics-server not installed
- metrics-server can’t scrape kubelets (TLS/self-signed certs)
- APIService v1beta1.metrics.k8s.io unavailable
- Pods without CPU requests (HPA percentage can’t be computed)
⚡ Quick fix
- Install metrics-server
- Check kubectl get apiservice v1beta1.metrics.k8s.io
- Set resources.requests.cpu on the pods
Detailed fix by platform
Kubernetes
- bash
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml kubectl -n kube-system logs deploy/metrics-server | tail kubectl get apiservice v1beta1.metrics.k8s.io
How to diagnose
- Server — metrics-server pod running?
- APIService — Available True?
- Requests — CPU requests set?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Kubernetes
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026