Alex Rivera | Logout

Kubernetes HPA not scaling pods based on custom Prometheus metrics

Asked 2025-11-18T11:10:00Z by Alex Rivera
38
I've configured a HorizontalPodAutoscaler to scale based on a custom metric exposed via the Prometheus adapter. The metric shows up correctly in 'kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1' but the HPA stays at minReplicas. Events show 'unable to get metric request_latency_p99'...
Edit
Report

1 Answer

45
Accepted
The issue is that your Prometheus adapter configuration is using the wrong metric naming convention. The HPA expects metrics in the format 'pods/request_latency_p99' but the adapter is registering it as 'request_latency_p99_seconds'. Check your adapter ConfigMap - you need a seriesQuery that matches your actual Prometheus metric name and a metricsQuery that performs the correct aggregation. Here's a working config I use in production...
answered 2025-11-18T14:30:00Z by David Petrov

Your Answer