mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #1840 from zoidbergwill/patch-1
Fix missing roles in prometheus kubernetes example
This commit is contained in:
commit
e980913cd6
|
@ -32,16 +32,38 @@ scrape_configs:
|
||||||
- api_servers:
|
- api_servers:
|
||||||
- 'https://kubernetes.default.svc'
|
- 'https://kubernetes.default.svc'
|
||||||
in_cluster: true
|
in_cluster: true
|
||||||
|
role: apiserver
|
||||||
|
|
||||||
|
- job_name: 'kubernetes-nodes'
|
||||||
|
|
||||||
|
# Default to scraping over https. If required, just disable this or change to
|
||||||
|
# `http`.
|
||||||
|
scheme: https
|
||||||
|
|
||||||
|
# This TLS & bearer token file config is used to connect to the actual scrape
|
||||||
|
# endpoints for cluster components. This is separate to discovery auth
|
||||||
|
# configuration (`in_cluster` below) because discovery & scraping are two
|
||||||
|
# separate concerns in Prometheus.
|
||||||
|
tls_config:
|
||||||
|
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
|
||||||
|
# If your node certificates are self-signed or use a different CA to the
|
||||||
|
# master CA, then disable certificate verification below. Note that
|
||||||
|
# certificate verification is an integral part of a secure infrastructure
|
||||||
|
# so this should only be disabled in a controlled environment. You can
|
||||||
|
# disable certificate verification by uncommenting the line below.
|
||||||
|
#
|
||||||
|
# insecure_skip_verify: true
|
||||||
|
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
|
||||||
|
|
||||||
|
kubernetes_sd_configs:
|
||||||
|
- api_servers:
|
||||||
|
- 'https://kubernetes.default.svc'
|
||||||
|
in_cluster: true
|
||||||
|
role: node
|
||||||
|
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [__meta_kubernetes_role]
|
|
||||||
action: keep
|
|
||||||
regex: (?:apiserver|node)
|
|
||||||
- action: labelmap
|
- action: labelmap
|
||||||
regex: __meta_kubernetes_node_label_(.+)
|
regex: __meta_kubernetes_node_label_(.+)
|
||||||
- source_labels: [__meta_kubernetes_role]
|
|
||||||
action: replace
|
|
||||||
target_label: kubernetes_role
|
|
||||||
|
|
||||||
# Scrape config for service endpoints.
|
# Scrape config for service endpoints.
|
||||||
#
|
#
|
||||||
|
@ -60,11 +82,12 @@ scrape_configs:
|
||||||
- api_servers:
|
- api_servers:
|
||||||
- 'https://kubernetes.default.svc'
|
- 'https://kubernetes.default.svc'
|
||||||
in_cluster: true
|
in_cluster: true
|
||||||
|
role: endpoint
|
||||||
|
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [__meta_kubernetes_role, __meta_kubernetes_service_annotation_prometheus_io_scrape]
|
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
|
||||||
action: keep
|
action: keep
|
||||||
regex: endpoint;true
|
regex: true
|
||||||
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
|
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
|
||||||
action: replace
|
action: replace
|
||||||
target_label: __scheme__
|
target_label: __scheme__
|
||||||
|
@ -80,9 +103,6 @@ scrape_configs:
|
||||||
replacement: $1:$2
|
replacement: $1:$2
|
||||||
- action: labelmap
|
- action: labelmap
|
||||||
regex: __meta_kubernetes_service_label_(.+)
|
regex: __meta_kubernetes_service_label_(.+)
|
||||||
- source_labels: [__meta_kubernetes_role]
|
|
||||||
action: replace
|
|
||||||
target_label: kubernetes_role
|
|
||||||
- source_labels: [__meta_kubernetes_service_namespace]
|
- source_labels: [__meta_kubernetes_service_namespace]
|
||||||
action: replace
|
action: replace
|
||||||
target_label: kubernetes_namespace
|
target_label: kubernetes_namespace
|
||||||
|
@ -106,11 +126,12 @@ scrape_configs:
|
||||||
- api_servers:
|
- api_servers:
|
||||||
- 'https://kubernetes.default.svc'
|
- 'https://kubernetes.default.svc'
|
||||||
in_cluster: true
|
in_cluster: true
|
||||||
|
role: service
|
||||||
|
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [__meta_kubernetes_role, __meta_kubernetes_service_annotation_prometheus_io_probe]
|
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
|
||||||
action: keep
|
action: keep
|
||||||
regex: service;true
|
regex: true
|
||||||
- source_labels: [__address__]
|
- source_labels: [__address__]
|
||||||
target_label: __param_target
|
target_label: __param_target
|
||||||
- target_label: __address__
|
- target_label: __address__
|
||||||
|
@ -119,8 +140,6 @@ scrape_configs:
|
||||||
target_label: instance
|
target_label: instance
|
||||||
- action: labelmap
|
- action: labelmap
|
||||||
regex: __meta_kubernetes_service_label_(.+)
|
regex: __meta_kubernetes_service_label_(.+)
|
||||||
- source_labels: [__meta_kubernetes_role]
|
|
||||||
target_label: kubernetes_role
|
|
||||||
- source_labels: [__meta_kubernetes_service_namespace]
|
- source_labels: [__meta_kubernetes_service_namespace]
|
||||||
target_label: kubernetes_namespace
|
target_label: kubernetes_namespace
|
||||||
- source_labels: [__meta_kubernetes_service_name]
|
- source_labels: [__meta_kubernetes_service_name]
|
||||||
|
@ -139,11 +158,12 @@ scrape_configs:
|
||||||
- api_servers:
|
- api_servers:
|
||||||
- 'https://kubernetes.default.svc'
|
- 'https://kubernetes.default.svc'
|
||||||
in_cluster: true
|
in_cluster: true
|
||||||
|
role: pod
|
||||||
|
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [__meta_kubernetes_role, __meta_kubernetes_pod_annotation_prometheus_io_scrape]
|
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
|
||||||
action: keep
|
action: keep
|
||||||
regex: pod;true
|
regex: true
|
||||||
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
|
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
|
||||||
action: replace
|
action: replace
|
||||||
regex: (.+):(?:\d+);(\d+)
|
regex: (.+):(?:\d+);(\d+)
|
||||||
|
|
Loading…
Reference in a new issue