diff --git a/jsonnet/kube-prometheus/dropping-deprecated-metrics-relabelings.libsonnet b/jsonnet/kube-prometheus/dropping-deprecated-metrics-relabelings.libsonnet new file mode 100644 index 0000000000000000000000000000000000000000..04faf1a265223c7549a5cc4e1a4c386e10c3180d --- /dev/null +++ b/jsonnet/kube-prometheus/dropping-deprecated-metrics-relabelings.libsonnet @@ -0,0 +1,50 @@ +[ + // Drop all kubelet metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'kubelet_(pod_worker_latency_microseconds|pod_start_latency_microseconds|cgroup_manager_latency_microseconds|pod_worker_start_latency_microseconds|pleg_relist_latency_microseconds|pleg_relist_interval_microseconds|runtime_operations|runtime_operations_latency_microseconds|runtime_operations_errors|eviction_stats_age_microseconds|device_plugin_registration_count|device_plugin_alloc_latency_microseconds)', + action: 'drop', + }, + // Drop all scheduler metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'scheduler_(e2e_scheduling_latency_microseconds|scheduling_algorithm_predicate_evaluation|scheduling_algorithm_priority_evaluation|scheduling_algorithm_preemption_evaluation|scheduling_algorithm_latency_microseconds|binding_latency_microseconds|scheduling_latency_seconds)', + action: 'drop', + }, + // Drop all apiserver metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'apiserver_(request_count|request_latencies|request_latencies_summary|dropped_requests|storage_data_key_generation_latencies_microseconds|storage_transformation_failures_total|storage_transformation_latencies_microseconds|proxy_tunnel_sync_latency_secs)', + action: 'drop', + }, + // Drop all docker metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'docker_(operations|operations_latency_microseconds|operations_errors|operations_timeout)', + action: 'drop', + }, + // Drop all reflector metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'reflector_(items_per_list|items_per_watch|list_duration_seconds|lists_total|short_watches_total|watch_duration_seconds|watches_total)', + action: 'drop', + }, + // Drop all etcd metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'etcd_(helper_cache_hit_count|helper_cache_miss_count|helper_cache_entry_count|request_cache_get_latencies_summary|request_cache_add_latencies_summary|request_latencies_summary)', + action: 'drop', + }, + // Drop all transformation metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'transformation_(transformation_latencies_microseconds|failures_total)', + action: 'drop', + }, + // Drop all other metrics which are deprecated in kubernetes. + { + sourceLabels: ['__name__'], + regex: 'network_plugin_operations_latency_microseconds|data_key_generation_latencies_microse|sync_proxy_rules_latency_microseconds|rest_client_request_latency_seconds', + action: 'drop', + }, +] diff --git a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet index 42f9191150b78bc05c5d504ce8745e5e1cd7346d..d3b9fccd5f26d696cd4b08f5b2ec33966f0bc869 100644 --- a/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet +++ b/jsonnet/kube-prometheus/prometheus/prometheus.libsonnet @@ -160,6 +160,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; local resourceRequirements = container.mixin.resourcesType; local selector = statefulSet.mixin.spec.selectorType; + local resources = resourceRequirements.new() + resourceRequirements.withRequests({ memory: '400Mi' }); @@ -287,7 +288,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; relabelings: [ { sourceLabels: ['__metrics_path__'], - targetLabel: 'metrics_path' + targetLabel: 'metrics_path', }, ], }, @@ -304,10 +305,10 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; relabelings: [ { sourceLabels: ['__metrics_path__'], - targetLabel: 'metrics_path' + targetLabel: 'metrics_path', }, ], - metricRelabelings: [ + metricRelabelings: (import 'kube-prometheus/dropping-deprecated-metrics-relabelings.libsonnet') + [ // Drop a bunch of metrics which are disabled but still sent, see // https://github.com/google/cadvisor/issues/1925. { @@ -347,7 +348,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; { port: 'http-metrics', interval: '30s', - metricRelabelings: [ + metricRelabelings: (import 'kube-prometheus/dropping-deprecated-metrics-relabelings.libsonnet') + [ { sourceLabels: ['__name__'], regex: 'etcd_(debugging|disk|request|server).*', @@ -402,7 +403,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet'; serverName: 'kubernetes', }, bearerTokenFile: '/var/run/secrets/kubernetes.io/serviceaccount/token', - metricRelabelings: [ + metricRelabelings: (import 'kube-prometheus/dropping-deprecated-metrics-relabelings.libsonnet') + [ { sourceLabels: ['__name__'], regex: 'etcd_(debugging|disk|request|server).*', diff --git a/manifests/prometheus-serviceMonitorApiserver.yaml b/manifests/prometheus-serviceMonitorApiserver.yaml index 5dea38e401421cd37bba16f8a8368407ee991601..b02917135abe0e5262340ddc9ed2d59403014bd3 100644 --- a/manifests/prometheus-serviceMonitorApiserver.yaml +++ b/manifests/prometheus-serviceMonitorApiserver.yaml @@ -10,6 +10,38 @@ spec: - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token interval: 30s metricRelabelings: + - action: drop + regex: kubelet_(pod_worker_latency_microseconds|pod_start_latency_microseconds|cgroup_manager_latency_microseconds|pod_worker_start_latency_microseconds|pleg_relist_latency_microseconds|pleg_relist_interval_microseconds|runtime_operations|runtime_operations_latency_microseconds|runtime_operations_errors|eviction_stats_age_microseconds|device_plugin_registration_count|device_plugin_alloc_latency_microseconds) + sourceLabels: + - __name__ + - action: drop + regex: scheduler_(e2e_scheduling_latency_microseconds|scheduling_algorithm_predicate_evaluation|scheduling_algorithm_priority_evaluation|scheduling_algorithm_preemption_evaluation|scheduling_algorithm_latency_microseconds|binding_latency_microseconds|scheduling_latency_seconds) + sourceLabels: + - __name__ + - action: drop + regex: apiserver_(request_count|request_latencies|request_latencies_summary|dropped_requests|storage_data_key_generation_latencies_microseconds|storage_transformation_failures_total|storage_transformation_latencies_microseconds|proxy_tunnel_sync_latency_secs) + sourceLabels: + - __name__ + - action: drop + regex: docker_(operations|operations_latency_microseconds|operations_errors|operations_timeout) + sourceLabels: + - __name__ + - action: drop + regex: reflector_(items_per_list|items_per_watch|list_duration_seconds|lists_total|short_watches_total|watch_duration_seconds|watches_total) + sourceLabels: + - __name__ + - action: drop + regex: etcd_(helper_cache_hit_count|helper_cache_miss_count|helper_cache_entry_count|request_cache_get_latencies_summary|request_cache_add_latencies_summary|request_latencies_summary) + sourceLabels: + - __name__ + - action: drop + regex: transformation_(transformation_latencies_microseconds|failures_total) + sourceLabels: + - __name__ + - action: drop + regex: network_plugin_operations_latency_microseconds|data_key_generation_latencies_microse|sync_proxy_rules_latency_microseconds|rest_client_request_latency_seconds + sourceLabels: + - __name__ - action: drop regex: etcd_(debugging|disk|request|server).* sourceLabels: diff --git a/manifests/prometheus-serviceMonitorKubeControllerManager.yaml b/manifests/prometheus-serviceMonitorKubeControllerManager.yaml index 153a90da112806239eef66354daf4616583433d5..264b8cad390d3976e92a93304a1c79fb211a98d1 100644 --- a/manifests/prometheus-serviceMonitorKubeControllerManager.yaml +++ b/manifests/prometheus-serviceMonitorKubeControllerManager.yaml @@ -9,6 +9,38 @@ spec: endpoints: - interval: 30s metricRelabelings: + - action: drop + regex: kubelet_(pod_worker_latency_microseconds|pod_start_latency_microseconds|cgroup_manager_latency_microseconds|pod_worker_start_latency_microseconds|pleg_relist_latency_microseconds|pleg_relist_interval_microseconds|runtime_operations|runtime_operations_latency_microseconds|runtime_operations_errors|eviction_stats_age_microseconds|device_plugin_registration_count|device_plugin_alloc_latency_microseconds) + sourceLabels: + - __name__ + - action: drop + regex: scheduler_(e2e_scheduling_latency_microseconds|scheduling_algorithm_predicate_evaluation|scheduling_algorithm_priority_evaluation|scheduling_algorithm_preemption_evaluation|scheduling_algorithm_latency_microseconds|binding_latency_microseconds|scheduling_latency_seconds) + sourceLabels: + - __name__ + - action: drop + regex: apiserver_(request_count|request_latencies|request_latencies_summary|dropped_requests|storage_data_key_generation_latencies_microseconds|storage_transformation_failures_total|storage_transformation_latencies_microseconds|proxy_tunnel_sync_latency_secs) + sourceLabels: + - __name__ + - action: drop + regex: docker_(operations|operations_latency_microseconds|operations_errors|operations_timeout) + sourceLabels: + - __name__ + - action: drop + regex: reflector_(items_per_list|items_per_watch|list_duration_seconds|lists_total|short_watches_total|watch_duration_seconds|watches_total) + sourceLabels: + - __name__ + - action: drop + regex: etcd_(helper_cache_hit_count|helper_cache_miss_count|helper_cache_entry_count|request_cache_get_latencies_summary|request_cache_add_latencies_summary|request_latencies_summary) + sourceLabels: + - __name__ + - action: drop + regex: transformation_(transformation_latencies_microseconds|failures_total) + sourceLabels: + - __name__ + - action: drop + regex: network_plugin_operations_latency_microseconds|data_key_generation_latencies_microse|sync_proxy_rules_latency_microseconds|rest_client_request_latency_seconds + sourceLabels: + - __name__ - action: drop regex: etcd_(debugging|disk|request|server).* sourceLabels: diff --git a/manifests/prometheus-serviceMonitorKubelet.yaml b/manifests/prometheus-serviceMonitorKubelet.yaml index 64edb0e490c924c28b3c20f4857cb1c50b9501ea..fb2188ba22293946cd55f9145603ff884a5beed4 100644 --- a/manifests/prometheus-serviceMonitorKubelet.yaml +++ b/manifests/prometheus-serviceMonitorKubelet.yaml @@ -22,6 +22,38 @@ spec: honorLabels: true interval: 30s metricRelabelings: + - action: drop + regex: kubelet_(pod_worker_latency_microseconds|pod_start_latency_microseconds|cgroup_manager_latency_microseconds|pod_worker_start_latency_microseconds|pleg_relist_latency_microseconds|pleg_relist_interval_microseconds|runtime_operations|runtime_operations_latency_microseconds|runtime_operations_errors|eviction_stats_age_microseconds|device_plugin_registration_count|device_plugin_alloc_latency_microseconds) + sourceLabels: + - __name__ + - action: drop + regex: scheduler_(e2e_scheduling_latency_microseconds|scheduling_algorithm_predicate_evaluation|scheduling_algorithm_priority_evaluation|scheduling_algorithm_preemption_evaluation|scheduling_algorithm_latency_microseconds|binding_latency_microseconds|scheduling_latency_seconds) + sourceLabels: + - __name__ + - action: drop + regex: apiserver_(request_count|request_latencies|request_latencies_summary|dropped_requests|storage_data_key_generation_latencies_microseconds|storage_transformation_failures_total|storage_transformation_latencies_microseconds|proxy_tunnel_sync_latency_secs) + sourceLabels: + - __name__ + - action: drop + regex: docker_(operations|operations_latency_microseconds|operations_errors|operations_timeout) + sourceLabels: + - __name__ + - action: drop + regex: reflector_(items_per_list|items_per_watch|list_duration_seconds|lists_total|short_watches_total|watch_duration_seconds|watches_total) + sourceLabels: + - __name__ + - action: drop + regex: etcd_(helper_cache_hit_count|helper_cache_miss_count|helper_cache_entry_count|request_cache_get_latencies_summary|request_cache_add_latencies_summary|request_latencies_summary) + sourceLabels: + - __name__ + - action: drop + regex: transformation_(transformation_latencies_microseconds|failures_total) + sourceLabels: + - __name__ + - action: drop + regex: network_plugin_operations_latency_microseconds|data_key_generation_latencies_microse|sync_proxy_rules_latency_microseconds|rest_client_request_latency_seconds + sourceLabels: + - __name__ - action: drop regex: container_(network_tcp_usage_total|network_udp_usage_total|tasks_state|cpu_load_average_10s) sourceLabels: