Interview Prep/Monitoring & Observability/Kubernetes monitoring and the Prometheus Operator

`kubectl top pods` returns `error: Metrics API not available`

BeginnerTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer

Likely causes → metrics-server is not installed or its APIService is unavailable (often TLS to kubelets).

Diagnose →

kubectl get apiservice v1beta1.metrics.k8s.io
kubectl logs -n kube-system deploy/metrics-server

Common log: x509: cannot validate certificate ... doesn't contain any IP SANs.

Fix → Install metrics-server; fix kubelet serving certs (enable serverTLSBootstrap), or as a lab-only workaround add --kubelet-insecure-tls.

Prevent → Remember HPA depends on it; alert on the APIService availability.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes monitoring and the Prometheus Operator