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.
More on Kubernetes monitoring and the Prometheus Operator
A new ServiceMonitor is not picked up by the Prometheus OperatorIntermediateServiceMonitor is selected but its targets don't appear on `/targets`IntermediateServiceMonitor target appears but Operator logs `skipping servicemonitor ... failed to get secret`AdvancedPodMonitor targets show `DOWN` with `connection refused` on port 8080 while the app listens on 9090BeginnerPrometheusRule created but rules don't show in PrometheusIntermediate`KubeletDown` / `TargetDown` alerts fire for kube-scheduler and kube-controller-manager on EKS/GKEBeginner