查看kubernetes中etcd集群狀態(tài)

查看 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狀態(tài)

$ 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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容