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.
More on Control plane, RBAC, webhooks and autoscaling
A developer gets `Error from server (Forbidden): pods is forbidden: User "[email protected]" cannot list resource "pods" in API group "" in the namespace "payments"`.BeginnerA CI pipeline fails with `deployments.apps "api" is forbidden: User "system:serviceaccount:ci:deployer" cannot patch resource "deployments" in API group "apps" in the namespace "prod"`.BeginnerA user can `get pods` but `kubectl logs` fails with `cannot get resource "pods/log"` and `kubectl exec` fails with `cannot create resource "pods/exec"`.BeginnerCreating a RoleBinding fails with `is attempting to grant RBAC permissions not currently held`.IntermediateEvery `kubectl apply` fails with `Internal error occurred: failed calling webhook "validate.kyverno.svc-fail": failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/validate/fail?timeout=10s": context deadline exceeded`.AdvancedCreating a Certificate fails with `failed calling webhook "webhook.cert-manager.io": ... no endpoints available for service "cert-manager-webhook"`.Intermediate