Connect Application High Performance Autoscaler (AHPA) to Managed Service for Prometheus to get a pre-built Grafana dashboard that shows CPU utilization, pod counts, and scaling predictions for your workloads.
Prerequisites
Before you begin, make sure that:
-
Managed Service for Prometheus is enabled for your cluster and the Prometheus Agent is version 3.0.0 or later. For more information, see Enable Prometheus monitoring.
-
AHPA is deployed and is version v2.0.0 or later. For more information, see Deploy AHPA.
-
The
application-intelligenceConfigMap in thekube-systemnamespace includes the following parameters:apiVersion: v1 kind: ConfigMap metadata: name: application-intelligence namespace: kube-system data: prometheus_writer_url: http://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/190601496873****/cd5ec926b715e41b282296d1415a1***/cn-hangzhou/api/v3/write prometheus_writer_ak: xxx prometheus_writer_sk: xx ...Parameter Description prometheus_writer_urlThe internal endpoint for Remote Write prometheus_writer_akYour AccessKey ID prometheus_writer_skYour AccessKey Secret
Connect AHPA to Managed Service for Prometheus
-
Log on to the ARMS console.
-
In the left navigation pane, click Integration Center and search for ACK AHPA.
-
Click the ACK AHPA resource card, then follow the on-screen instructions to select your Container Service for Kubernetes (ACK) cluster and configure the connection.
Parameter Description Access Name A unique name for this AHPA monitoring instance metrics collection interval (seconds) The interval at which monitoring data is collected
View the AHPA dashboard
-
Log on to the ARMS console.
-
In the left navigation pane, click Integration Management, then click the Integrated Addons tab.
-
Click the ACK AHPA resource card, go to the Dashboards tab, and click a dashboard name to open it in Grafana.
The dashboard displays the following panels:
-
CPU Utilization & Actual POD: The average CPU utilization and the current number of pods for the workload.
-
Actual and Predicted CPU Usage: The total CPU usage of all pods alongside the predicted usage. When predicted usage exceeds actual usage, AHPA has reserved enough CPU capacity for the anticipated load.
-
Pod Trends: The number of pods across three dimensions:
-
Actual Pods: The number of pods currently running.
-
Recommended Pods: The final pod count that AHPA recommends, based on proactive prediction, reactive prediction, and the boundary range.
-
Proactive Prediction: The pod count predicted from historical data and detected traffic periodicity.
-
Key AHPA metrics
The following metrics are available in Managed Service for Prometheus after you connect AHPA.
| Metric | Description |
|---|---|
ahpa_proactive_pods |
Number of pods predicted for a future period based on historical metrics and traffic periodicity |
ahpa_reactive_pods |
Number of pods predicted in real time |
ahpa_requested_pods |
Number of recommended pods |
ahpa_max_pods |
Maximum number of pods |
ahpa_min_pods |
Minimum number of pods |
ahpa_target_metric |
Target threshold |
What's next
To scale your application based on custom metrics such as HTTP requests per second (QPS) or message queue length, see Use AHPA to configure custom metrics for application autoscaling.