查看 etcd 集群成员列表
$ export ETCDCTL_API=3
$ alias etcdctl='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'
$ etcdctl member list
7afd54467ead876f, started, k8s-master02.ade.corp.lan, https://10.10.3.12:2380, https://10.10.3.12:2379, false
a5070a1e961013f0, started, k8s-master03.ade.corp.lan, https://10.10.3.13:2380, https://10.10.3.13:2379, false
bfd451309bf09004, started, k8s-master01.ade.corp.lan, https://10.10.3.11:2380, https://10.10.3.11:2379, false
查看etcd endpoint状态
$ alias etcdctl='etcdctl --endpoints=https://10.10.3.11:2379,https://10.10.3.12:2379,https://10.10.3.13:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key'
$ etcdctl endpoint status --write-out=table
+-------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+-------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://10.10.3.11:2379 | bfd451309bf09004 | 3.4.3 | 22 MB | false | false | 589 | 7665839 | 7665832 | |
| https://10.10.3.12:2379 | 7afd54467ead876f | 3.4.3 | 22 MB | false | false | 589 | 7665841 | 7665839 | |
| https://10.10.3.13:2379 | a5070a1e961013f0 | 3.4.3 | 22 MB | true | false | 589 | 7665841 | 7665841 | |
+-------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
查看etcd endpoint 健康
$ alias etcdctl='etcdctl --endpoints=https://10.10.3.11:2379,https://10.10.3.12:2379,https://10.10.3.13:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key'
$ etcdctl endpoint health
https://10.10.3.13:2379 is healthy: successfully committed proposal: took = 30.700722ms
https://10.10.3.12:2379 is healthy: successfully committed proposal: took = 31.431028ms
https://10.10.3.11:2379 is healthy: successfully committed proposal: took = 161.128702ms
网友评论