Hii
I am facing some issues with defining Prometheus scrape config for kuberentes_sd_config.
This is my current config:
- job_name: kubernetes-pods
kubernetes_sd_configs:
- role: pod
relabel_configs:
- action: keep
regex: true
source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_scrape
- action: replace
regex: (.+)
source_labels:
- __meta_kubernetes_pod_annotation_prometheus_io_path
target_label: __metrics_path__
- action: replace
regex: ([^:]+)(?::\d+)?;(\d+)
replacement: $1:$2
source_labels:
- __address__
- __meta_kubernetes_pod_annotation_prometheus_io_port
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- action: replace
source_labels:
- __meta_kubernetes_namespace
target_label: kubernetes_namespace
- action: replace
source_labels:
- __meta_kubernetes_pod_name
target_label: kubernetes_pod_name
And I have pods annotated as :
<http://prometheus.io/scrape|prometheus.io/scrape>: 'true'
<http://prometheus.io/port|prometheus.io/port>: '8000'
But I noticed other ports are also getting scraped alongwith 8000.
I found a similar issue here https://github.com/prometheus/prometheus/issues/2208, but in my case its not possible to define a port with name metrics as mentioned in https://github.com/prometheus/prometheus/issues/2208#issuecomment-261902167
Any other way to achieve this?