# 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)

- **ID:** `kubernetes/horizontal-pod-autoscaler-unable-to-get-metrics`
- **Domain:** kubernetes
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Metrics Server is not deployed or not functioning, so the Horizontal Pod Autoscaler cannot retrieve CPU/memory metrics.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Metrics Server v0.6.4 | active | — | — |
| Kubernetes v1.28.0 | active | — | — |
| Kubernetes v1.29.0 | active | — | — |

## Workarounds

1. **Deploy Metrics Server: `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`.** (90% success)
   ```
   Deploy Metrics Server: `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`.
   ```
2. **If Metrics Server is installed but not working, check its logs: `kubectl logs -n kube-system deployment/metrics-server`. Common issues include TLS or node name resolution problems.** (80% success)
   ```
   If Metrics Server is installed but not working, check its logs: `kubectl logs -n kube-system deployment/metrics-server`. Common issues include TLS or node name resolution problems.
   ```
3. **For Minikube or kind clusters, enable metrics-server addon: `minikube addons enable metrics-server` or use kind's config to deploy it.** (85% success)
   ```
   For Minikube or kind clusters, enable metrics-server addon: `minikube addons enable metrics-server` or use kind's config to deploy it.
   ```

## Dead Ends

- **Increasing HPA target thresholds or replica limits** — HPA still needs metrics to function; changing thresholds won't fix the missing metrics source. (95% fail)
- **Restarting the HPA controller manager** — The HPA controller is healthy; the issue is the metrics API backend, not the controller. (80% fail)
