The recommended way to run etcd for kubernetes is to have your etcd cluster outside of the kubernetes cluster. But you also run Prometheus via the Prometheus Operator to monitor everything about your cluster. So how do you get prometheus to monitor your etcd cluster if it isn’t technically a service in kubernetes? We need 3 ingredients: a service
to which we attach the endpoints
of the nodes, a service monitor
and a secret
.
Service (with endpoints)
First the service
that will describe our etcd cluster must be created. Moreover, here were are going to list the endpoints
for our etcd servers and then attach them to our service
. Change the IP addresses to match the IPs of your etcd servers. The way these endpoints
are connected to the service
is through the name
property of the metadata: this must match the name of the service
.