Earlier this year, we announced native support for Google Kubernetes Engine (GKE) custom metrics. This milestone allowed you to scrap external adapters and instead collect autoscaling metrics directly from your pods. By routing these metrics straight to the Horizontal Pod Autoscaler (HPA), we cut metrics reading latency down to 5 seconds.
Today, we are excited to introduce built-in support for processing Prometheus metrics, allowing you to use expressive PromQL queries to customize autoscaling triggers. With this update, HPA can now directly process autoscaling metrics present in Cloud Monitoring using Google Managed Service for Prometheus. Reading metrics from these backends will not require third-party adapters, leveraging the AutoscalingMetric integration used to support pod-level metrics. After the preview, we plan to support self-hosted Prometheus servers as we move to general availability.
The challenge: Setting up Cloud Monitoring metrics
Support for custom pod-level metrics made autoscaling more straightforward, but production workloads often need to scale on multiple, complex infrastructure metrics. Common examples include scaling:
-
a worker pool based on the number of unacknowledged messages in a Pub/Sub topic
-
an inference service based on query-per-second (QPS) metrics stored in Cloud Monitoring / Prometheus
-
a webserver farm based on the 95th percentile of their measured response time
To achieve this, you used to need to deploy an external adapter like the Stackdriver Custom Metrics Adapter or the Prometheus adapter to retrieve the metrics from an external logging environment. While this sounds straightforward at first, these adapters introduce a lot of operational friction:
-
Management overhead: Platform teams have to install, configure, patch, and monitor these third-party components.
-
Reliability and inefficiency: Intermediate adapter pods reading from external systems introduce failure points in critical autoscaling loops.
-
IAM complexity: Enabling secure cross-component communication requires setting up Kubernetes service account mappings to Cloud service accounts including their permissions.
And while setting up this system and maintaining it not impossible, it’s complex and features a complicated architecture:
Source Credit: https://cloud.google.com/blog/products/containers-kubernetes/native-support-for-prometheus-metrics-in-gke/
