Alibaba Cloud Managed Service for Prometheus includes default service discovery to collect metrics from Container Service for Kubernetes (ACK) clusters using standard Prometheus rules, streamlining cluster O&M and performance analysis.
Limitation
This feature applies only to instances deployed in ACK clusters.
Billing
Default service discovery provided by Alibaba Cloud Managed Service for Prometheus incurs fees.
If your cluster previously used open-source Prometheus with default service discovery configurations, migrating to Managed Service for Prometheus retains these settings, resulting in service discovery costs.
Prerequisites
An ACK cluster is created and connected to Managed Service for Prometheus through the Integration Center.
ImportantIf your ACK cluster is not connected through the Integration Center, this feature cannot be enabled.
Pods requiring metric exposure are annotated with standard Prometheus rules. To add annotations:
Log on to the ACK console.
On the Clusters page, find the cluster and click its name. In the left-side navigation pane, choose
.Find the pod and click Edit in the Actions column to add the following annotations:
annotations: prometheus.io/path: /metrics # The HTTP path where you want to expose the metrics. prometheus.io/port: "xxxx" # The port on which you want to expose the metrics. prometheus.io/scrape: "true" # Specify whether to capture the metrics.
Click Update.
Enable default service discovery
In the left-side navigation pane, click Integration Management.
On the Integrated Environments tab, view the environment list on the Container Service tab. Find the ACK instance and click Metric Scraping in the Actions column.
On the Metric Scraping tab, click Default Service Discovery.
On the Default Service Discovery page, click Enabled to enable this feature.
After it is enabled, Managed Service for Prometheus collects the metrics exposed by all pods with the following annotations in the cluster:
annotations: prometheus.io/path: /metrics # The HTTP path where you want to expose the metrics. prometheus.io/port: "xxxx" # The port on which you want to expose the metrics. prometheus.io/scrape: "true" # Specify whether to capture the metrics.
On the Metric Scraping tab, view the list of pods found by this feature.
Disable default service discovery
On the Default Service Discovery page, click Feature Disabled to disable this feature. After it is disabled, Managed Service for Prometheus no longer collects metrics exposed by pods with the prometheus.io
annotations.