FailedGetResourceMetric
The HorizontalPodAutoscaler can’t compute utilisation, so it holds the current replica count. kubectl get hpa shows <unknown> in the targets column.
Warning FailedGetResourceMetric horizontal-pod-autoscaler failed to get cpu utilization: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)Diagnose in order
Section titled “Diagnose in order”- Is the metrics API available?
kubectl get apiservice v1beta1.metrics.k8s.ioshould beAvailable True, andkubectl top podsshould work. - Do the target pods set requests for that resource? Utilisation is usage divided by request. No request means no utilisation:
failed to get cpu utilization: missing request for cpu. - Are the pods Ready? Pods that are starting or not Ready are handled specially and can leave the HPA with too few samples.
Usual causes
Section titled “Usual causes”| Message | Cause |
|---|---|
could not find the requested resource (get pods.metrics.k8s.io) |
metrics-server not installed or its APIService not available |
missing request for cpu |
A container in the pod has no CPU request (including sidecars) |
metrics-server logs show x509 errors to kubelets |
metrics-server can’t verify kubelet serving certificates |
Install or repair metrics-server, and set requests on every container in the target pods, including sidecars. For kind or lab clusters, metrics-server often needs its kubelet TLS settings adjusted; don’t carry that adjustment into production.