背景
k8s中的网络配置和对象状态信息都会保存到etcd中,所以我们可以通过etcdctl查看保存在数据库中的信息文章来源:https://www.toymoban.com/news/detail-836519.html
常用操作
- 查看etcd的各个节点的状态
[root@master3 ~]# etcdctl --endpoints="10.197.115.27:2379,10.197.115.25:2379,10.197.115.26:2379" --cacert=/etc/ssl/etcd/ssl/ca.pem --cert=/etc/ssl/etcd/ssl/member-master3.pem --key=/etc/ssl/etcd/ssl/member-master3-key.pem endpoint health
10.197.115.25:2379 is healthy: successfully committed proposal: took = 11.379015ms
10.197.115.26:2379 is healthy: successfully committed proposal: took = 19.969601ms
10.197.115.27:2379 is healthy: successfully committed proposal: took = 27.590939ms
- k8s所有的资源信息都保存在/registry中
[root@master3 ~]# etcdctl --endpoints="10.197.115.27:2379,10.197.115.25:2379,10.197.115.26:2379" --cacert=/etc/ssl/etcd/ssl/ca.pem --cert=/etc/ssl/etcd/ssl/member-master3.pem --key=/etc/ssl/etcd/ssl/member-master3-key.pem --prefix --keys-only=true get /registry
/registry/apiextensions.k8s.io/customresourcedefinitions/apiservices.management.cattle.io
/registry/apiextensions.k8s.io/customresourcedefinitions/applications.argoproj.io
/registry/apiextensions.k8s.io/customresourcedefinitions/applicationsets.argoproj.io
/registry/apiextensions.k8s.io/customresourcedefinitions/appprojects.argoproj.io
/registry/apiextensions.k8s.io/customresourcedefinitions/apps.catalog.cattle.io
/registry/apiextensions.k8s.io/customresourcedefinitions/authconfigs.management.cattle.io
/registry/apiextensions.k8s.io/customresourcedefinitions/bgpconfigurations.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/bgppeers.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/blockaffinities.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/caliconodestatuses.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/clusterinformations.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/clusterregistrationtokens.management.cattle.io
- 查看保存在registry中的信息,这里以/registry/clusterroles/system:kube-dns为例
[root@master3 ~]# etcdctl --endpoints="10.197.115.27:2379,10.197.115.25:2379,10.197.115.26:2379" --cacert=/etc/ssl/etcd/ssl/ca.pem --cert=/etc/ssl/etcd/ssl/member-master3.pem --key=/etc/ssl/etcd/ssl/member-master3-key.pem --prefix --keys-only=false get /registry/clusterroles/system:kube-dns
文章来源地址https://www.toymoban.com/news/detail-836519.html
到了这里,关于etcdctl查看k8s资源信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!