How to Find ETCD Leader and Check ETCD Health

Problem

How to find ETCD Leader and check ETCD Health in a Platform9 Managed Kubernetes Cluster?

Environment

  • Platform9 Managed Kubernetes - All Versions

  • ETCD

  • Docker and Containerd

Procedure

  1. SSH into any one of the Master nodes and become a root user.

  2. For docker based container runtime: Run the following command to copy the etcdctl binary from the etcd container running on the node and update the PATH variable.

docker cp etcd:/usr/local/bin/etcdctl /opt/pf9/pf9-kube/bin 

export PATH=$PATH:/opt/pf9/pf9-kube/bin
  1. Run the etcdctl command to find out the ETCD Leader and look for IS LEADER column

# /opt/pf9/pf9-kube/bin/etcdctl  endpoint status -w=table
+----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|    ENDPOINT    |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| 127.0.0.1:2379 | 5ad09a7031a6a983 |  3.4.14 |   13 MB |     false |      false |        83 |    6676368 |            6676368 |        |
+----------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
{% endtab %}
{% tab language="bash" title="Containerd" %}
# sudo /opt/pf9/pf9-kube/bin/etcdctl --cacert=/etc/pf9/kube.d/certs/etcdctl/etcd/ca.crt --cert=/etc/pf9/kube.d/certs/etcdctl/etcd/request.crt --key=/etc/pf9/kube.d/certs/etcdctl/etcd/request.key endpoint status --cluster  -w=table
  1. Run the etcdctl command to check ETCD Health of Member/Endpoints.

Additional Information

Kubernetes Docs - Configure/Upgrade ETCD

Last updated