Skip to content

Instantly share code, notes, and snippets.

@SuperQ
Last active June 8, 2022 13:49
Show Gist options
  • Save SuperQ/d61e405e3464da4a766808f6329c5c1e to your computer and use it in GitHub Desktop.
Save SuperQ/d61e405e3464da4a766808f6329c5c1e to your computer and use it in GitHub Desktop.
Drop excessive cAdvisor metrics from kube-prometheus-stack helm chart.
# Taken from https://bugzilla.redhat.com/show_bug.cgi?id=1801154
kubeApiServer:
serviceMonitor:
metricRelabelings:
- action: drop
regex: apiserver_request_duration_seconds_bucket;(0.15|0.25|0.3|0.35|0.4|0.45|0.6|0.7|0.8|0.9|1.25|1.5|1.75|2.5|3|3.5|4.5|6|7|8|9|15|25|30|50)
sourceLabels:
- __name__
- le
kubelet:
serviceMonitor:
cAdvisorMetricRelabelings:
# Drop less useful container CPU metrics.
- 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: '.+;'
# Drop cgroup metrics with no container.
- sourceLabels: [id, container]
action: drop
regex: '.+;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment