In below command for —endpoints give the https client address endpoint of each control node, Replace the leader ID in this case d5907367f2bc466 with the leader ID of the Control Node you wish to change the Leader to.
Main Menu
- Home
- Kubernetes
- Containerization Stack (DevOps)
- Oracle Cloud Native Environment (OCNE)
- Linux
- Linux "FIND" Command related Articles
- Linux "YUM" Command related Articles
- Linux "PS" Command related Articles
- "AWK" Command related Articles
- Linux "RPM" Command related Articles
- "PING" Command related Articles
- "NTP" related Articles
- Linux Network related Articles and Commands
- Linux Security related Articles
- Linux Troubleshooting Articles
- Linux FILESYSTEM related Articles
- Linux INFINIBAND Network related Articles
- Linux "MOUNT" Command related Articles
- Linux Shell Script Articles
- "BIOS" related Linux Articles
- "NFS" related Articles
- "GREP" Commands related Articles
- Linux "CPU" & "Memory" related Articles
- "SED" Command related Articles
- "SYSTEMCTL" Commands related Articles
- Logical Volumes related Articles
- "TCPDUMPS" related Articles
- GitHub Repositories (tarbots)
- About tarbots
Search
KUBERNETES: How to Change ETCD Leader From One Control Node To Other Using ETCDCTL Commands?
In below command for —endpoints give the https client address endpoint of each control node, Replace the leader ID in this case d5907367f2bc466 with the leader ID of the Control Node you wish to change the Leader to.
KUBERNETES (K8S): ETCDCTL Command To Delete Pod Registry Entry From ETCD Database
KUBERNETES: ETCDCTL Command To List All the Keys Of all Pods In Kubernetes Cluster From ETCD Database
KUBERNETES: ETCDCTL Command To List All the Keys Of Kubernetes resources in ETCD Database
KUBERNETES (K8S): ETCDCTL Command To Check Health of ETCD Member Endpoints
Below is command to use. Replace 10.XX.XX.219 and 10.XX.XX.86 endpoint IPs with the client address IPs of the ETCD member's
ETCDCTL_API=3 etcdctl --endpoints=https://10.XX.XX.219:2379,https://10.XX.XX.86:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key endpoint health -w table
You can gather client address IPs for etcd member nodes using etcdctl member list command. Details can be found in https://www.tarbots.com/2024/01/tarun-boyella-kubernetes-k8s-etcdctl-command-to-list-the-members-of-etcd-and-their-details.html
KUBERNETES (K8S): ETCDCTL Command To Check the Performance and Health of etcd
Below command can be used.
sudo ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key check perf
Above command will run for a minute and then report the response time and health status of etcd whether it is pass. Below is sample output.
sudo ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key check perf
59 / 60 Booooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom ! 98.33%PASS: Throughput is 150 writes/s
PASS: Slowest request took 0.015323s
PASS: Stddev is 0.000739s
PASS
KUBERNETES (K8S): ETCDCTL Command To List the Members of ETCD And Their Details
Below etcdctl command can be used to list the members of etcd and their detials.
sudo ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key member list -w table
Below is sample output of the command.
+------------------+---------+----------------+-------------------------+-------------------------+------------+
| ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS | IS LEARNER |
+------------------+---------+----------------+-------------------------+-------------------------+------------+
| 1581f4841997c696 | started | cne14-control1 | https://10.XX.XX.219:2380 | https://10.XX.XX.219:2379 | false |
| d79b8841ab930268 | started | cne14-control2 | https://10.XX.XX.86:2380 | https://10.XX.XX.86:2379 | false |
+------------------+---------+----------------+-------------------------+-------------------------+------------+
KUBERNETES (K8S): ETCDCTL Command To Update Member of ETCD
Below etcdctl command can be used.
ETCDCTL_API=3 etcdctl \
--endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
member update 1581f4841997c696 --peer-urls=https://10.XX.XX.219:2380
In above command replace 1581f4841997c696 ID with member ID of the node you want to replace and --peer-urls with the peer URL of the member ID that you are updating.
For getting the member ID and peer URL you can use below ETCDCTL Command.
sudo ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key member list -w table
Below is sample output of the command.
+------------------+---------+----------------+-------------------------+-------------------------+------------+
| ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS | IS LEARNER |
+------------------+---------+----------------+-------------------------+-------------------------+------------+
| 1581f4841997c696 | started | cne14-control1 | https://10.XX.XX.219:2380 | https://10.XX.XX.219:2379 | false |
| d79b8841ab930268 | started | cne14-control2 | https://10.XX.XX.86:2380 | https://10.XX.XX.86:2379 | false |
+------------------+---------+----------------+-------------------------+-------------------------+------------+