Interview Prep/Kubernetes/Control plane, RBAC, webhooks and autoscaling

HPA reports `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)`.

IntermediateTroubleshootingControl plane, RBAC, webhooks and autoscaling
Answer

Likely causes → metrics-server is missing or its APIService is not Available, so the HPA has no data.

Diagnose →

kubectl get apiservice v1beta1.metrics.k8s.io -o jsonpath='{.status.conditions}' | jq
kubectl -n kube-system logs deploy/metrics-server --tail=30

Fix → Install or repair metrics-server. A typical log error x509: cannot validate certificate for 10.0.1.5 because it doesn't contain any IP SANs means kubelet serving certificates lack IP SANs: enable serverTLSBootstrap: true on kubelets and approve the CSRs (or use --kubelet-insecure-tls only in labs).

Prevent → Alert on the APIService being unavailable; HPA silently stops scaling otherwise.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Control plane, RBAC, webhooks and autoscaling