From 2bbe5732b774d42553a22e6240bb6e570acc4cd9 Mon Sep 17 00:00:00 2001 From: Ilya Margolin Date: Mon, 31 Jan 2022 15:08:23 +0100 Subject: [PATCH] Add node label to etcd metrics (#8475) targetRef on endpoints surfaces as __meta_kubernetes_endpoint_address_target_kind/__meta_kubernetes_endpoint_address_target_name in prometheus and gets converted to the label `node` by prometheus-operator --- .../ansible/templates/etcd_metrics-endpoints.yml.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes-apps/ansible/templates/etcd_metrics-endpoints.yml.j2 b/roles/kubernetes-apps/ansible/templates/etcd_metrics-endpoints.yml.j2 index d8b4bcd90..18f515d18 100644 --- a/roles/kubernetes-apps/ansible/templates/etcd_metrics-endpoints.yml.j2 +++ b/roles/kubernetes-apps/ansible/templates/etcd_metrics-endpoints.yml.j2 @@ -7,9 +7,12 @@ metadata: k8s-app: etcd app.kubernetes.io/managed-by: Kubespray subsets: -{% for etcd_metrics_address in etcd_metrics_addresses.split(',') %} +{% for etcd_metrics_address, etcd_host in etcd_metrics_addresses.split(',') | zip(etcd_hosts) %} - addresses: - ip: {{ etcd_metrics_address | urlsplit('hostname') }} + targetRef: + kind: Node + name: {{ etcd_host }} ports: - name: http-metrics port: {{ etcd_metrics_address | urlsplit('port') }}