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

HPA on a custom metric reports `unable to get metric http_requests_per_second: no metrics returned from custom metrics API`

AdvancedTroubleshootingKubernetes monitoring and the Prometheus Operator
Answer

Likely causes → prometheus-adapter rules don't expose the metric, the query returns no series for that namespace/pod, or the APIService v1beta1.custom.metrics.k8s.io is down.

Diagnose →

kubectl get apiservice v1beta1.custom.metrics.k8s.io
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1/namespaces/shop/pods/*/http_requests_per_second" | jq

Fix → Add an adapter rule with seriesQuery, resources.overrides mapping namespace/pod labels, and metricsQuery; or use KEDA's Prometheus scaler.

Prevent → Test custom metric queries before wiring them to HPAs.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes monitoring and the Prometheus Operator