Prometheus: Configure multiple label selectors for kubernetes_sd_configs

Viewed 16

I want to configure Prometheus with Kubernetes Service Discovery and filter pods by labels.

Unfortunately, the following way doesn't work:

kubernetes_sd_configs:
- role: pod
  selectors:
  - role: pod
    label: "app=MyApp"
  - role: pod
    label: "type=client"

I get an error:

"Error loading config (--config.file=/etc/prometheus/prometheus.yml)" file=/etc/prometheus/prometheus.yml err="parsing YAML file /etc/prometheus/prometheus.yml: duplicated selector role: pod"

Is it possible to configure multiple label selectors?

0 Answers
Related