Problem
Obtain the details of an ETCD cluster including RAFT TERM, INDEX, and DB SIZE for a Kubernetes cluster.
Environment
- Platform9 Managed Kubernetes - v4.0 and Higher
- ETCD
Procedure
- Copy etcdctl binary from the etcd container on any of the master nodes.
# docker cp <etcd containerName>:/usr/local/bin/etcdctl <destination path>
- Get etcd endpoints list and store into the ETCDCTL_ENDPOINTS variable.
# export ETCDCTL_ENDPOINTS=$(./etcdctl --ca-file /etc/pf9/kube.d/certs/etcdctl/etcd/ca.crt --cert-file /etc/pf9/kube.d/certs/etcdctl/etcd/request.crt --key-file /etc/pf9/kube.d/certs/etcdctl/etcd/request.key member list | cut -d " " -f4 | sed -e 's/clientURLs=//g'| paste -sd ',')
- Set the etcd API version to 3.
# export ETCDCTL_API=3
- Run the following command to get the ETCD cluster details.
# ./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 --write-out table