This repository was archived by the owner on May 31, 2022. It is now read-only.
[Q] Autodiscovery of roadrunner pods with prometheus #106
Answered
by
victor-sudakov
victor-sudakov
asked this question in
Q&A
|
Dear Colleagues, If you use Prometheus to autodiscover and monitor RoadRunner pods, can you please share you config? I've configured annotations on the RoadRunner pods: and put the following into prometheus.yml: I can view the metrics statically by running I'd be very grateful for a good example. And yes, the service account the prometheus pod is running as seems to have all the necessary permissions to list, get and watch pods clusterwide. |
Answered by
victor-sudakov
Dec 7, 2021
Replies: 1 comment
|
The seemingly working config snippet is below. scrape_configs:
- job_name: "kubernetes-pods"
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_nameIt relies on the roadrunner pods being annotated with annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9090" |
0 replies
Answer selected by
victor-sudakov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The seemingly working config snippet is below.