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.
Before you begin
This feature applies only to instances deployed in ACK clusters.
Pods with annotations in the
arms-promnamespace in ACK clusters automatically collect metrics, regardless of whether this feature is enabled.
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.
Prerequisite
An ACK cluster is created and connected to Managed Service for Prometheus through the Integration Center.
If your ACK cluster is not connected through the Integration Center, this feature cannot be enabled.
Enable default service discovery
Step 1: Add annotations
Log on to the ACK console.
On the Clusters page, find the cluster and click its name. In the left 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 scrape the metrics.Click Update.
Step 2: Enable the feature
Log on to the ARMS console.
In the left 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 scrape 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.