Created
December 28, 2023 09:58
-
-
Save JoooostB/65358658519402b3035c85fb25aba262 to your computer and use it in GitHub Desktop.
Scrape kubelet & cAdvisor metrics using ServiceMonitor below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: monitoring.coreos.com/v1 | |
kind: ServiceMonitor | |
metadata: | |
labels: | |
app: kubelet | |
scraper: prometheus-agent | |
name: kubelet | |
spec: | |
endpoints: | |
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | |
honorLabels: true | |
interval: 30s | |
port: https-metrics | |
scheme: https | |
tlsConfig: | |
insecureSkipVerify: true | |
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token | |
honorLabels: true | |
interval: 30s | |
path: /metrics/cadvisor | |
port: https-metrics | |
scheme: https | |
tlsConfig: | |
insecureSkipVerify: true | |
relabelings: | |
- sourceLabels: [__name__] | |
action: drop | |
regex: "container_cpu_(cfs_throttled_seconds_total|load_average_10s|system_seconds_total|user_seconds_total)" | |
# Drop less useful container / always zero filesystem metrics. | |
- sourceLabels: [__name__] | |
action: drop | |
regex: "container_fs_(io_current|io_time_seconds_total|io_time_weighted_seconds_total|reads_merged_total|sector_reads_total|sector_writes_total|writes_merged_total)" | |
# Drop less useful / always zero container memory metrics. | |
- sourceLabels: [__name__] | |
action: drop | |
regex: "container_memory_(mapped_file|swap)" | |
# Drop less useful container process metrics. | |
- sourceLabels: [__name__] | |
action: drop | |
regex: "container_(file_descriptors|tasks_state|threads_max)" | |
# Drop container spec metrics that overlap with kube-state-metrics. | |
- sourceLabels: [__name__] | |
action: drop | |
regex: "container_spec.*" | |
# Drop cgroup metrics with no pod. | |
- sourceLabels: [id, pod] | |
action: drop | |
regex: ".+;" | |
jobLabel: k8s-app | |
namespaceSelector: | |
matchNames: | |
- kube-system | |
selector: | |
matchLabels: | |
k8s-app: kubelet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment