摘要:
记录访问k8s内的etcd的数据
环境准备:
k8s集群:
需要注意以下文件只在master节点上存在
cert: /etc/kubernetes/pki/apiserver-etcd-client.crt
key: /etc/kubernetes/pki/apiserver-etcd-client.key
cacert: /etc/kubernetes/pki/etcd/ca.crt
etcd:
必须使用V3版本: export ETCDCTL_API=3
必须通过密钥访问
访问命令:
export ETCDCTL_API=3
查看member list
etcdctl --endpoints="https://127.0.0.1:2379" --cert=/etc/kubernetes/pki/apiserver-etcd-client.crt --key=/etc/kubernetes/pki/apiserver-etcd-client.key --cacert=/etc/kubernetes/pki/etcd/ca.crt member list --write-out="table"
[root@node-201 etcd] :19:57.543850 I | warning: ignoring ServerName user-provided CA backwards compatibility is deprecated | ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS | | e73652a384b03536 | started | node-201 | https://192.168.58.201:2380 | https://192.168.58.201:2379 |
查看所有的key:
etcdctl --endpoints=https://127.0.0.1:2379 --cert=/etc/kubernetes/pki/apiserver-etcd-client.crt --key=/etc/kubernetes/pki/apiserver-etcd-client.key --cacert=/etc/kubernetes/pki/etcd/ca.crt get --prefix / --keys-only=true