Enable default service discovery to scrape metrics from Pods in your container cluster that match default Prometheus scraping rules, simplifying cluster O&M and performance analysis.
Important notes
-
Available only for container environment instances.
-
Pods with annotations in the
arms-promnamespace are always scraped, regardless of whether default service discovery is enabled.
Billing
-
Default service discovery incurs fees. Billing for Managed Service for Prometheus.
-
If your cluster runs open-source Prometheus with default service discovery, after you integrate Alibaba Cloud Managed Service for Prometheus, Alibaba Cloud Managed Service for Prometheus inherits those configurations and incurs default service discovery charges. Prometheus instance billing.
Prerequisites
-
A container cluster is created. Create an ACK managed cluster.
-
Your cluster is connected through the Integration Center. Integration overview.
ImportantDefault service discovery requires the cluster to be connected through the Integration Center.
Step 1: Add annotations
-
Log on to the ACK console.
-
On the Clusters page, click the name of your cluster. In the left navigation pane, click .
-
Find the target Pod, click Edit in the Actions column, and add the following annotations.
annotations: prometheus.io/path: /metrics # The HTTP path of the metrics endpoint. prometheus.io/port: "xxxx" # The port of the metrics endpoint. prometheus.io/scrape: "true" # Specifies whether to scrape metrics from this Pod. -
Click Update.
Step 2: Enable default service discovery
-
In the navigation pane on the left, click Integration Management.
-
On the Integrated Environments tab, find the target environment in the Container Environment list. Click Metric Scraping in the Actions column to open the Metric Scraping page.
-
On the Metric Scraping tab, click Default Service Discovery.
-
On the Default Service Discovery page, click Enable Feature.
Once enabled, Managed Service for Prometheus scrapes metrics from all Pods in the cluster with the following annotations.
annotations: prometheus.io/path: /metrics # The HTTP path of the metrics endpoint. prometheus.io/port: "xxxx" # The port of the metrics endpoint. prometheus.io/scrape: "true" # Specifies whether to scrape metrics from this Pod. -
The Metric Scraping tab lists all Pods that match the default service discovery criteria.
Related operations
On the Default Service Discovery page, click Disable Feature. Once disabled, Managed Service for Prometheus no longer scrapes metrics from Pods with the prometheus.io annotation.
Common causes of integration failures and troubleshooting
-
Incorrect annotation configuration: Check whether
prometheus.io/scrapeis set to"true", and whetherprometheus.io/portandprometheus.io/pathpoint to the correct port and path. -
Container environment not connected to Managed Service for Prometheus: Confirm that the container environment has been connected through the Integration Center. Pods that are not in the
arms-promnamespace require default service discovery to be manually enabled. -
Pod does not expose the metrics endpoint correctly: Access the
/metricspath of the Pod to confirm that it returns data in Prometheus format. -
Network connectivity issues: Check whether the network between the Prometheus instance and the Pod is connected.