Allow to scrape etcd metrics using a service (#8203)

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
This commit is contained in:
Mathieu Parent
2021-11-18 08:53:01 +01:00
committed by GitHub
parent 8176e9155b
commit 0263c649f4
8 changed files with 99 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: Endpoints
metadata:
name: etcd-metrics
namespace: kube-system
labels:
k8s-app: etcd
app.kubernetes.io/managed-by: Kubespray
subsets:
{% for etcd_metrics_address in etcd_metrics_addresses.split(',') %}
- addresses:
- ip: {{ etcd_metrics_address | urlsplit('hostname') }}
ports:
- name: http-metrics
port: {{ etcd_metrics_address | urlsplit('port') }}
protocol: TCP
{% endfor %}

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: etcd-metrics
namespace: kube-system
labels:
{{ etcd_metrics_service_labels | to_yaml(indent=2, width=1337) | indent(width=4) }}
spec:
ports:
- name: http-metrics
protocol: TCP
port: {{ etcd_metrics_port }}
# targetPort: