Tretsche
Tretsche

Reputation: 11

How to disable the k8s scrape pool for some containers (Prometheus Operator)

I'm using the kube-prometheus-stack which uses the prometheus-operator and I am seeing a lot of logging messages because prometheus is trying to access the /metrics endpoint of my application, which is not allowed (because not existing). When I open Prometheus-WebUI/Targets is see there a "k8s"-target which lists all containers with "/metrics"-endpoints. Most of them are down, including the one which produces the annoying logs.

How can I disable this pool completely or for some containers/pods?

I couldn't find any configuration of this pool (no serviceMonitor, no configMap, ...), also the documentation is not telling anything about a k8s-scrape-pool (or at least I couldn't find).

Upvotes: 0

Views: 525

Answers (1)

Tretsche
Tretsche

Reputation: 11

I found it: It was created by my own additionalScrapeConfig

      additionalScrapeConfigs:
        - job_name: k8s
          kubernetes_sd_configs:
            - role: pod
          relabel_configs:
            - action: labelmap
              regex: "__meta_kubernetes_pod_label_(.+)"
              replacement: "label_$1"

I didn't know, that this would produce a new scrape pool. I only additionally wanted the pod-labels.

Upvotes: 1

Related Questions