Configure a PodMonitor to scrape metrics exposed by specific pods in your container cluster, making Prometheus monitoring more flexible, automated, and easier to manage.
Limitations
This feature is available only for instances in a container environment.
Billing
-
Using a PodMonitor incurs fees. For more information, see Billing of Prometheus instances.
-
If your cluster has an existing open-source Prometheus service with PodMonitor configurations, when you connect the cluster to Managed Service for Prometheus, Managed Service for Prometheus automatically inherits the existing configurations, which will cause you to incur charges related to PodMonitor. For billing information, see Prometheus Instance Billing.
Prerequisites
-
A container environment instance, which is a container cluster, has been created. For more information, see Create an ACK managed cluster.
-
The target pods in the container cluster expose metrics as expected.
Procedure
-
Log on to the Cloud Monitor console.
-
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 Pod Monitor.
Enable the PodMonitor feature
On the PodMonitor page, click Enable Feature. After the feature is enabled, you can view all PodMonitors and their configurations in the current container cluster. Managed Service for Prometheus scrapes metrics based on the configured time interval and Path.
This feature is enabled by default.

Manage PodMonitors
Create a PodMonitor
On the Pod Monitor page, click Add. In the Add PodMonitor Configuration panel, enter the PodMonitor YAML configuration, and then click Create.
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: pod-monitor1
namespace: ns1
annotations:
arms.prometheus.io/discovery: 'true'
spec:
selector:
matchLabels:
app: app1
release: xxx
namespaceSelector:
any: true
podMetricsEndpoints:
- interval: 30s
Edit a PodMonitor
Find the target configuration and click Modify Settings in the Actions column. In the Edit PodMonitor Configuration panel, modify the YAML content.
Delete a PodMonitor
Find the target configuration and click Delete in the Actions column.
Disable a PodMonitor
Find the target configuration and click Disable in the Actions column. Once disabled, the configuration no longer takes effect.
Disable the PodMonitor feature
On the PodMonitor page, click Disable Feature. After the feature is disabled, Managed Service for Prometheus stops discovering and scraping metrics exposed by Pods, but scraping for existing Targets continues.