From bd032743a660a93355d8fcb33400a60ae10866e3 Mon Sep 17 00:00:00 2001 From: Jie Yu Date: Fri, 10 Jan 2020 08:18:35 -0800 Subject: [PATCH] [promethesus-adapter] use the new tag name (#19961) Some metrics labels (namely `pod_name` and `container_name`) have been removed in Kubernetes 1.16 (deprecated for a few releases). This patch switch to use the new metrics labels so that metrics can be properly retrieved and parsed from Prometheus. See more details about the removal of metrics labels here: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.16.md#removed-metrics Also, bump the min supported Kubernetes version to 1.14 because the new metrics labels are introduced in 1.14. See the following release notes: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.14.md Signed-off-by: Jie Yu --- stable/prometheus-adapter/Chart.yaml | 2 +- stable/prometheus-adapter/README.md | 10 +++++----- .../templates/custom-metrics-configmap.yaml | 18 +++++++++--------- stable/prometheus-adapter/values.yaml | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/stable/prometheus-adapter/Chart.yaml b/stable/prometheus-adapter/Chart.yaml index 45ba22e8a9..78a0b3b365 100644 --- a/stable/prometheus-adapter/Chart.yaml +++ b/stable/prometheus-adapter/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: prometheus-adapter -version: 1.4.0 +version: 2.0.0 appVersion: v0.5.0 description: A Helm chart for k8s prometheus adapter home: https://github.com/DirectXMan12/k8s-prometheus-adapter diff --git a/stable/prometheus-adapter/README.md b/stable/prometheus-adapter/README.md index 4c43d2f63d..942ca6dcc5 100644 --- a/stable/prometheus-adapter/README.md +++ b/stable/prometheus-adapter/README.md @@ -4,7 +4,7 @@ Installs the [Prometheus Adapter](https://github.com/DirectXMan12/k8s-prometheus ## Prerequisites -Kubernetes 1.11+ +Kubernetes 1.14+ ## Installing the Chart @@ -74,9 +74,9 @@ rules: resource: node namespace: resource: namespace - pod_name: + pod: resource: pod - containerLabel: container_name + containerLabel: container memory: containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>) nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>) @@ -86,9 +86,9 @@ rules: resource: node namespace: resource: namespace - pod_name: + pod: resource: pod - containerLabel: container_name + containerLabel: container window: 3m ``` diff --git a/stable/prometheus-adapter/templates/custom-metrics-configmap.yaml b/stable/prometheus-adapter/templates/custom-metrics-configmap.yaml index 5b035900ad..0864af71f8 100644 --- a/stable/prometheus-adapter/templates/custom-metrics-configmap.yaml +++ b/stable/prometheus-adapter/templates/custom-metrics-configmap.yaml @@ -12,46 +12,46 @@ data: config.yaml: | rules: {{- if .Values.rules.default }} - - seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}' + - seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}' seriesFilters: [] resources: overrides: namespace: resource: namespace - pod_name: + pod: resource: pod name: matches: ^container_(.*)_seconds_total$ as: "" - metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[5m])) + metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[5m])) by (<<.GroupBy>>) - - seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}' + - seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}' seriesFilters: - isNot: ^container_.*_seconds_total$ resources: overrides: namespace: resource: namespace - pod_name: + pod: resource: pod name: matches: ^container_(.*)_total$ as: "" - metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}[5m])) + metricsQuery: sum(rate(<<.Series>>{<<.LabelMatchers>>,container!="POD"}[5m])) by (<<.GroupBy>>) - - seriesQuery: '{__name__=~"^container_.*",container_name!="POD",namespace!="",pod_name!=""}' + - seriesQuery: '{__name__=~"^container_.*",container!="POD",namespace!="",pod!=""}' seriesFilters: - isNot: ^container_.*_total$ resources: overrides: namespace: resource: namespace - pod_name: + pod: resource: pod name: matches: ^container_(.*)$ as: "" - metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>,container_name!="POD"}) by (<<.GroupBy>>) + metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>,container!="POD"}) by (<<.GroupBy>>) - seriesQuery: '{namespace!="",__name__!~"^container_.*"}' seriesFilters: - isNot: .*_total$ diff --git a/stable/prometheus-adapter/values.yaml b/stable/prometheus-adapter/values.yaml index 4e13ad6c51..ba1a5c4c80 100644 --- a/stable/prometheus-adapter/values.yaml +++ b/stable/prometheus-adapter/values.yaml @@ -71,9 +71,9 @@ rules: # resource: node # namespace: # resource: namespace -# pod_name: +# pod: # resource: pod -# containerLabel: container_name +# containerLabel: container # memory: # containerQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>}) by (<<.GroupBy>>) # nodeQuery: sum(container_memory_working_set_bytes{<<.LabelMatchers>>,id='/'}) by (<<.GroupBy>>) @@ -83,9 +83,9 @@ rules: # resource: node # namespace: # resource: namespace -# pod_name: +# pod: # resource: pod -# containerLabel: container_name +# containerLabel: container # window: 3m service: