2015-09-29 00:02:01 -07:00
|
|
|
# A scrape configuration for running prometheus in cluster on kubernetes. It
|
|
|
|
# will create endpoints for node and master roles, as well as any service
|
|
|
|
# which is annotated with `prometheus_io_scrape=true`
|
2015-07-18 14:23:58 -07:00
|
|
|
|
|
|
|
scrape_configs:
|
|
|
|
- job_name: 'kubernetes'
|
|
|
|
|
|
|
|
kubernetes_sd_configs:
|
2015-09-03 02:47:09 -07:00
|
|
|
- masters:
|
|
|
|
- 'https://kubernetes.default.svc'
|
2015-07-18 14:23:58 -07:00
|
|
|
in_cluster: true
|
2015-09-29 00:02:01 -07:00
|
|
|
tls_config:
|
|
|
|
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
|
|
|
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
|
2015-07-18 14:23:58 -07:00
|
|
|
|
|
|
|
relabel_configs:
|
2015-09-03 02:47:09 -07:00
|
|
|
- source_labels: [__meta_kubernetes_role, __meta_kubernetes_service_annotation_prometheus_io_scrape]
|
2015-07-18 14:23:58 -07:00
|
|
|
action: keep
|
2015-09-03 02:47:09 -07:00
|
|
|
regex: ^(?:(?:master|node);.*|.*;true)$
|
2015-07-18 14:23:58 -07:00
|
|
|
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
|
|
|
|
action: replace
|
|
|
|
target_label: __scheme__
|
|
|
|
regex: ^(https?)$
|
|
|
|
replacement: $1
|
|
|
|
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
|
|
|
|
action: replace
|
|
|
|
target_label: __metrics_path__
|
|
|
|
regex: ^(.+)$
|
|
|
|
replacement: $1
|
|
|
|
- source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
|
|
|
|
action: replace
|
|
|
|
target_label: __address__
|
|
|
|
regex: ^(.+)(?::\d+);(\d+)$
|
|
|
|
replacement: $1:$2
|