categraf/k8s/scrape_with_kubeconfig.yaml

90 lines
2.3 KiB
YAML

global:
scrape_interval: 15s
#external_labels:
# cluster: test
# replica: 0
scrape_configs:
#- job_name: "categraf-out"
# static_configs:
# - targets: ["172.16.6.171:8080"]
- job_name: "apiserver"
metrics_path: "/metrics"
kubernetes_sd_configs:
- role: endpoints
kubeconfig_file: /path/to/.kube/config
scheme: https
tls_config:
insecure_skip_verify: true
authorization:
credentials_file: /path/to/token
relabel_configs:
- source_labels:
[
__meta_kubernetes_namespace,
__meta_kubernetes_service_name,
__meta_kubernetes_endpoint_port_name,
]
action: keep
regex: default;kubernetes;https
- job_name: "controller-manager"
metrics_path: "/metrics"
kubernetes_sd_configs:
- role: endpoints
kubeconfig_file: /path/to/.kube/config
scheme: https
tls_config:
insecure_skip_verify: true
authorization:
credentials_file: /path/to/token
relabel_configs:
- source_labels:
[
__meta_kubernetes_namespace,
__meta_kubernetes_service_name,
__meta_kubernetes_endpoint_port_name,
]
action: keep
regex: kube-system;kube-controller-manager;https
- job_name: "scheduler"
metrics_path: "/metrics"
kubernetes_sd_configs:
- role: endpoints
kubeconfig_file: /path/to/.kube/config
scheme: https
tls_config:
insecure_skip_verify: true
authorization:
credentials_file: /path/to/token
relabel_configs:
- source_labels:
[
__meta_kubernetes_namespace,
__meta_kubernetes_service_name,
__meta_kubernetes_endpoint_port_name,
]
action: keep
regex: kube-system;kube-scheduler;https
- job_name: "coredns"
metrics_path: "/metrics"
kubernetes_sd_configs:
- role: endpoints
kubeconfig_file: /path/to/.kube/config
scheme: http
relabel_configs:
- source_labels:
[
__meta_kubernetes_namespace,
__meta_kubernetes_service_name,
__meta_kubernetes_endpoint_port_name,
]
action: keep
regex: kube-system;kube-dns;metrics
remote_write:
- url: 'http://172.31.62.213/prometheus/v1/write'