查看ECTD中数据的方法

kubernetes的API对象的数据都保存在etcd中

我们在实际环境中要管理ETCD需要使用ETCDCTL工具,所以我们需要下载相关工具

下载地址是:https://github.com/etcd-io/etcd/releases

目前最新版是3.5.4,我们下载解包,然后添加环境变量即可使用etcdctl工具

wget https://github.com/etcd-io/etcd/releases/download/v3.5.4/etcd-v3.5.4-linux-amd64.tar.gz
tar -zxvf etcd-v3.5.4-linux-amd64.tar.gz
cd etcd-v3.5.4-linux-amd64

然后做一个软连接就可以开始使用了

ln -s /root/etcd-v3.5.4-linux-amd64/etcdctl /usr/bin/etcdctl
etcdctl version
etcdctl version: 3.5.4API version: 3.5

我们可以使用命令来获取所有key

etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key get / --prefix --keys-only
#返回
/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/clusterinformations.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/felixconfigurations.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/globalnetworkpolicies.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/globalnetworksets.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/hostendpoints.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/imagesets.operator.tigera.io
/registry/apiextensions.k8s.io/customresourcedefinitions/installations.operator.tigera.io
/registry/apiextensions.k8s.io/customresourcedefinitions/ipamblocks.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/ipamconfigs.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/ipamhandles.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/ippools.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/kubecontrollersconfigurations.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/networkpolicies.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/networksets.crd.projectcalico.org
/registry/apiextensions.k8s.io/customresourcedefinitions/tigerastatuses.operator.tigera.io
/registry/apiregistration.k8s.io/apiservices/v1.
/registry/apiregistration.k8s.io/apiservices/v1.admissionregistration.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.apiextensions.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.apps
/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.autoscaling
/registry/apiregistration.k8s.io/apiservices/v1.batch
/registry/apiregistration.k8s.io/apiservices/v1.coordination.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.crd.projectcalico.org
/registry/apiregistration.k8s.io/apiservices/v1.networking.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.operator.tigera.io
/registry/apiregistration.k8s.io/apiservices/v1.rbac.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.scheduling.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1.storage.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.admissionregistration.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.apiextensions.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.authentication.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.batch
/registry/apiregistration.k8s.io/apiservices/v1beta1.certificates.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.coordination.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.discovery.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.events.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.extensions
/registry/apiregistration.k8s.io/apiservices/v1beta1.networking.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.node.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.policy
/registry/apiregistration.k8s.io/apiservices/v1beta1.rbac.authorization.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.scheduling.k8s.io
/registry/apiregistration.k8s.io/apiservices/v1beta1.storage.k8s.io
/registry/apiregistration.k8s.io/apiservices/v2beta1.autoscaling
/registry/apiregistration.k8s.io/apiservices/v2beta2.autoscaling
/registry/clusterrolebindings/calico-kube-controllers
/registry/clusterrolebindings/calico-node
/registry/clusterrolebindings/calico-typha
/registry/clusterrolebindings/cluster-admin
/registry/clusterrolebindings/kubeadm:get-nodes
/registry/clusterrolebindings/kubeadm:kubelet-bootstrap
/registry/clusterrolebindings/kubeadm:node-autoapprove-bootstrap
/registry/clusterrolebindings/kubeadm:node-autoapprove-certificate-rotation
/registry/clusterrolebindings/kubeadm:node-proxier
/registry/clusterrolebindings/system:basic-user
/registry/clusterrolebindings/system:controller:attachdetach-controller
/registry/clusterrolebindings/system:controller:certificate-controller
/registry/clusterrolebindings/system:controller:clusterrole-aggregation-controller
/registry/clusterrolebindings/system:controller:cronjob-controller
/registry/clusterrolebindings/system:controller:daemon-set-controller
/registry/clusterrolebindings/system:controller:deployment-controller
/registry/clusterrolebindings/system:controller:disruption-controller
/registry/clusterrolebindings/system:controller:endpoint-controller
/registry/clusterrolebindings/system:controller:endpointslice-controller
/registry/clusterrolebindings/system:controller:expand-controller
/registry/clusterrolebindings/system:controller:generic-garbage-collector
/registry/clusterrolebindings/system:controller:horizontal-pod-autoscaler
/registry/clusterrolebindings/system:controller:job-controller
/registry/clusterrolebindings/system:controller:namespace-controller
/registry/clusterrolebindings/system:controller:node-controller
/registry/clusterrolebindings/system:controller:persistent-volume-binder
/registry/clusterrolebindings/system:controller:pod-garbage-collector
/registry/clusterrolebindings/system:controller:pv-protection-controller
/registry/clusterrolebindings/system:controller:pvc-protection-controller
/registry/clusterrolebindings/system:controller:replicaset-controller
/registry/clusterrolebindings/system:controller:replication-controller
/registry/clusterrolebindings/system:controller:resourcequota-controller
/registry/clusterrolebindings/system:controller:route-controller
/registry/clusterrolebindings/system:controller:service-account-controller
/registry/clusterrolebindings/system:controller:service-controller
/registry/clusterrolebindings/system:controller:statefulset-controller
/registry/clusterrolebindings/system:controller:ttl-controller
/registry/clusterrolebindings/system:coredns
/registry/clusterrolebindings/system:discovery
/registry/clusterrolebindings/system:kube-controller-manager
/registry/clusterrolebindings/system:kube-dns
/registry/clusterrolebindings/system:kube-scheduler
/registry/clusterrolebindings/system:node
/registry/clusterrolebindings/system:node-proxier
/registry/clusterrolebindings/system:public-info-viewer
/registry/clusterrolebindings/system:volume-scheduler
/registry/clusterrolebindings/tigera-operator
/registry/clusterroles/admin
/registry/clusterroles/calico-kube-controllers
/registry/clusterroles/calico-node
/registry/clusterroles/calico-typha
/registry/clusterroles/cluster-admin
/registry/clusterroles/edit
/registry/clusterroles/kubeadm:get-nodes
/registry/clusterroles/system:aggregate-to-admin
/registry/clusterroles/system:aggregate-to-edit
/registry/clusterroles/system:aggregate-to-view
/registry/clusterroles/system:auth-delegator
/registry/clusterroles/system:basic-user
/registry/clusterroles/system:certificates.k8s.io:certificatesigningrequests:nodeclient
/registry/clusterroles/system:certificates.k8s.io:certificatesigningrequests:selfnodeclient
/registry/clusterroles/system:certificates.k8s.io:kube-apiserver-client-approver
/registry/clusterroles/system:certificates.k8s.io:kube-apiserver-client-kubelet-approver
/registry/clusterroles/system:certificates.k8s.io:kubelet-serving-approver
/registry/clusterroles/system:certificates.k8s.io:legacy-unknown-approver
/registry/clusterroles/system:controller:attachdetach-controller
/registry/clusterroles/system:controller:certificate-controller
/registry/clusterroles/system:controller:clusterrole-aggregation-controller
/registry/clusterroles/system:controller:cronjob-controller
/registry/clusterroles/system:controller:daemon-set-controller
/registry/clusterroles/system:controller:deployment-controller
/registry/clusterroles/system:controller:disruption-controller
/registry/clusterroles/system:controller:endpoint-controller
/registry/clusterroles/system:controller:endpointslice-controller
/registry/clusterroles/system:controller:expand-controller
/registry/clusterroles/system:controller:generic-garbage-collector
/registry/clusterroles/system:controller:horizontal-pod-autoscaler
/registry/clusterroles/system:controller:job-controller
/registry/clusterroles/system:controller:namespace-controller
/registry/clusterroles/system:controller:node-controller
/registry/clusterroles/system:controller:persistent-volume-binder
/registry/clusterroles/system:controller:pod-garbage-collector
/registry/clusterroles/system:controller:pv-protection-controller
/registry/clusterroles/system:controller:pvc-protection-controller
/registry/clusterroles/system:controller:replicaset-controller
/registry/clusterroles/system:controller:replication-controller
/registry/clusterroles/system:controller:resourcequota-controller
/registry/clusterroles/system:controller:route-controller
/registry/clusterroles/system:controller:service-account-controller
/registry/clusterroles/system:controller:service-controller
/registry/clusterroles/system:controller:statefulset-controller
/registry/clusterroles/system:controller:ttl-controller
/registry/clusterroles/system:coredns
/registry/clusterroles/system:discovery
/registry/clusterroles/system:heapster
/registry/clusterroles/system:kube-aggregator
/registry/clusterroles/system:kube-controller-manager
/registry/clusterroles/system:kube-dns
/registry/clusterroles/system:kube-scheduler
/registry/clusterroles/system:kubelet-api-admin
/registry/clusterroles/system:node
/registry/clusterroles/system:node-bootstrapper
/registry/clusterroles/system:node-problem-detector
/registry/clusterroles/system:node-proxier
/registry/clusterroles/system:persistent-volume-provisioner
/registry/clusterroles/system:public-info-viewer
/registry/clusterroles/system:volume-scheduler
/registry/clusterroles/tigera-operator
/registry/clusterroles/view
/registry/configmaps/calico-system/cni-config
/registry/configmaps/calico-system/typha-ca
/registry/configmaps/kube-public/cluster-info
/registry/configmaps/kube-system/coredns
/registry/configmaps/kube-system/extension-apiserver-authentication
/registry/configmaps/kube-system/kube-proxy
/registry/configmaps/kube-system/kubeadm-config
/registry/configmaps/kube-system/kubelet-config-1.18
/registry/configmaps/tigera-operator/operator-lock
/registry/configmaps/tigera-operator/typha-ca
/registry/controllerrevisions/calico-system/calico-node-745858b955
/registry/controllerrevisions/kube-system/kube-proxy-7c8f76db5b
/registry/crd.projectcalico.org/blockaffinities/k8s-master-10-244-235-192-26
/registry/crd.projectcalico.org/blockaffinities/k8s-node1-10-244-36-64-26
/registry/crd.projectcalico.org/blockaffinities/k8s-node2-10-244-169-128-26
/registry/crd.projectcalico.org/clusterinformations/default
/registry/crd.projectcalico.org/felixconfigurations/default
/registry/crd.projectcalico.org/ipamblocks/10-244-169-128-26
/registry/crd.projectcalico.org/ipamblocks/10-244-235-192-26
/registry/crd.projectcalico.org/ipamblocks/10-244-36-64-26
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.7f56d240ceff9cdac8d243b3c9ce89527da1cbf3c2404076fb2a576836df2bc2
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.8ae0a142f4cd3d605dd5ea2c5a7448ba33b5e00e75b8c984e430cd965bbc9c17
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.ac2b976e5ed95a205de14485491e4830c1a5c637fb2af473e6e99e114fc818bf
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.c57e67dc3c3580a0a0ea4c6422adb0887ae160b4848ec743fe45d3a4d7a13ac9
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.cece4d1e17a0b9c1adf4920b0cd3e0a3f3da15f4c832bc43cbe6f06ce8d27094
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.e112af928140dab21a338159c2e15fb5aa3aa0a4786bb5f06eae10c824858a89
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.f541873a9fc6c54f5008e5e899b7be6e6f8b296cbfb878b9efa22b7bdfb936a0
/registry/crd.projectcalico.org/ipamhandles/k8s-pod-network.f8d3403717d0daeec30da8f6b77b97e5ab465dbb80523a5ea5a1af71fe746859
/registry/crd.projectcalico.org/ipamhandles/vxlan-tunnel-addr-k8s-master
/registry/crd.projectcalico.org/ipamhandles/vxlan-tunnel-addr-k8s-node1
/registry/crd.projectcalico.org/ipamhandles/vxlan-tunnel-addr-k8s-node2
/registry/crd.projectcalico.org/ippools/default-ipv4-ippool
/registry/crd.projectcalico.org/kubecontrollersconfigurations/default
/registry/csinodes/k8s-master
/registry/csinodes/k8s-node1
/registry/csinodes/k8s-node2
/registry/daemonsets/calico-system/calico-node
/registry/daemonsets/kube-system/kube-proxy
/registry/deployments/calico-system/calico-kube-controllers
/registry/deployments/calico-system/calico-typha
/registry/deployments/kube-system/coredns
/registry/deployments/tigera-operator/tigera-operator
/registry/endpointslices/calico-system/calico-kube-controllers-metrics-86gfl
/registry/endpointslices/calico-system/calico-typha-bdkzd
/registry/endpointslices/default/kubernetes
/registry/endpointslices/kube-system/kube-dns-fd9r2
/registry/leases/kube-node-lease/k8s-master
/registry/leases/kube-node-lease/k8s-node1
/registry/leases/kube-node-lease/k8s-node2
/registry/leases/kube-system/kube-controller-manager
/registry/leases/kube-system/kube-scheduler
/registry/leases/tigera-operator/operator-lock
/registry/masterleases/192.168.1.72
/registry/minions/k8s-master
/registry/minions/k8s-node1
/registry/minions/k8s-node2
/registry/namespaces/calico-system
/registry/namespaces/default
/registry/namespaces/kube-node-lease
/registry/namespaces/kube-public
/registry/namespaces/kube-system
/registry/namespaces/tigera-operator
/registry/operator.tigera.io/installations/default
/registry/operator.tigera.io/tigerastatuses/calico
/registry/poddisruptionbudgets/calico-system/calico-typha
/registry/pods/calico-system/calico-kube-controllers-6f9c88fcd6-4n9k6
/registry/pods/calico-system/calico-node-5sxv6
/registry/pods/calico-system/calico-node-742wd
/registry/pods/calico-system/calico-node-q7q9m
/registry/pods/calico-system/calico-typha-7bb74886ff-82mw2
/registry/pods/calico-system/calico-typha-7bb74886ff-gcn7m
/registry/pods/calico-system/calico-typha-7bb74886ff-hsrb9
/registry/pods/kube-system/coredns-546565776c-m7rm8
/registry/pods/kube-system/coredns-546565776c-r75jj
/registry/pods/kube-system/etcd-k8s-master
/registry/pods/kube-system/kube-apiserver-k8s-master
/registry/pods/kube-system/kube-controller-manager-k8s-master
/registry/pods/kube-system/kube-proxy-dnwsw
/registry/pods/kube-system/kube-proxy-ds8l9
/registry/pods/kube-system/kube-proxy-kjxf9
/registry/pods/kube-system/kube-scheduler-k8s-master
/registry/pods/tigera-operator/tigera-operator-6bdd5f4ddd-6pf7k
/registry/podsecuritypolicy/calico-kube-controllers
/registry/podsecuritypolicy/calico-node
/registry/podsecuritypolicy/calico-typha
/registry/podsecuritypolicy/tigera-operator
/registry/priorityclasses/calico-priority
/registry/priorityclasses/system-cluster-critical
/registry/priorityclasses/system-node-critical
/registry/ranges/serviceips
/registry/ranges/servicenodeports
/registry/replicasets/calico-system/calico-kube-controllers-6f9c88fcd6
/registry/replicasets/calico-system/calico-typha-7bb74886ff
/registry/replicasets/kube-system/coredns-546565776c
/registry/replicasets/tigera-operator/tigera-operator-6bdd5f4ddd
/registry/rolebindings/kube-public/kubeadm:bootstrap-signer-clusterinfo
/registry/rolebindings/kube-public/system:controller:bootstrap-signer
/registry/rolebindings/kube-system/kube-proxy
/registry/rolebindings/kube-system/kubeadm:kubelet-config-1.18
/registry/rolebindings/kube-system/kubeadm:nodes-kubeadm-config
/registry/rolebindings/kube-system/system::extension-apiserver-authentication-reader
/registry/rolebindings/kube-system/system::leader-locking-kube-controller-manager
/registry/rolebindings/kube-system/system::leader-locking-kube-scheduler
/registry/rolebindings/kube-system/system:controller:bootstrap-signer
/registry/rolebindings/kube-system/system:controller:cloud-provider
/registry/rolebindings/kube-system/system:controller:token-cleaner
/registry/roles/kube-public/kubeadm:bootstrap-signer-clusterinfo
/registry/roles/kube-public/system:controller:bootstrap-signer
/registry/roles/kube-system/extension-apiserver-authentication-reader
/registry/roles/kube-system/kube-proxy
/registry/roles/kube-system/kubeadm:kubelet-config-1.18
/registry/roles/kube-system/kubeadm:nodes-kubeadm-config
/registry/roles/kube-system/system::leader-locking-kube-controller-manager
/registry/roles/kube-system/system::leader-locking-kube-scheduler
/registry/roles/kube-system/system:controller:bootstrap-signer
/registry/roles/kube-system/system:controller:cloud-provider
/registry/roles/kube-system/system:controller:token-cleaner
/registry/secrets/calico-system/calico-kube-controllers-token-bl44g
/registry/secrets/calico-system/calico-node-token-kj8fq
/registry/secrets/calico-system/calico-typha-token-qlqkz
/registry/secrets/calico-system/default-token-svcxp
/registry/secrets/calico-system/node-certs
/registry/secrets/calico-system/typha-certs
/registry/secrets/default/default-token-cvc2p
/registry/secrets/kube-node-lease/default-token-b9vht
/registry/secrets/kube-public/default-token-qv9sg
/registry/secrets/kube-system/attachdetach-controller-token-lcdqm
/registry/secrets/kube-system/bootstrap-signer-token-vg8cv
/registry/secrets/kube-system/certificate-controller-token-28wwp
/registry/secrets/kube-system/clusterrole-aggregation-controller-token-95mbp
/registry/secrets/kube-system/coredns-token-2rzjz
/registry/secrets/kube-system/cronjob-controller-token-bllj8
/registry/secrets/kube-system/daemon-set-controller-token-22twx
/registry/secrets/kube-system/default-token-sqsgc
/registry/secrets/kube-system/deployment-controller-token-tpc2m
/registry/secrets/kube-system/disruption-controller-token-v2lss
/registry/secrets/kube-system/endpoint-controller-token-2r8wr
/registry/secrets/kube-system/endpointslice-controller-token-8rt95
/registry/secrets/kube-system/expand-controller-token-mfqr6
/registry/secrets/kube-system/generic-garbage-collector-token-ltfxg
/registry/secrets/kube-system/horizontal-pod-autoscaler-token-62g9x
/registry/secrets/kube-system/job-controller-token-c5rgd
/registry/secrets/kube-system/kube-proxy-token-cq6gz
/registry/secrets/kube-system/namespace-controller-token-lqf5j
/registry/secrets/kube-system/node-controller-token-lvwg7
/registry/secrets/kube-system/persistent-volume-binder-token-lktmj
/registry/secrets/kube-system/pod-garbage-collector-token-4jx5g
/registry/secrets/kube-system/pv-protection-controller-token-q77xn
/registry/secrets/kube-system/pvc-protection-controller-token-g8lzd
/registry/secrets/kube-system/replicaset-controller-token-j5sbw
/registry/secrets/kube-system/replication-controller-token-r46mg
/registry/secrets/kube-system/resourcequota-controller-token-4n2ht
/registry/secrets/kube-system/service-account-controller-token-jgc5l
/registry/secrets/kube-system/service-controller-token-cpq4n
/registry/secrets/kube-system/statefulset-controller-token-kws8w
/registry/secrets/kube-system/token-cleaner-token-zkhml
/registry/secrets/kube-system/ttl-controller-token-wr628
/registry/secrets/tigera-operator/default-token-7kqjp
/registry/secrets/tigera-operator/node-certs
/registry/secrets/tigera-operator/tigera-operator-token-bptvw
/registry/secrets/tigera-operator/typha-certs
/registry/serviceaccounts/calico-system/calico-kube-controllers
/registry/serviceaccounts/calico-system/calico-node
/registry/serviceaccounts/calico-system/calico-typha
/registry/serviceaccounts/calico-system/default
/registry/serviceaccounts/default/default
/registry/serviceaccounts/kube-node-lease/default
/registry/serviceaccounts/kube-public/default
/registry/serviceaccounts/kube-system/attachdetach-controller
/registry/serviceaccounts/kube-system/bootstrap-signer
/registry/serviceaccounts/kube-system/certificate-controller
/registry/serviceaccounts/kube-system/clusterrole-aggregation-controller
/registry/serviceaccounts/kube-system/coredns
/registry/serviceaccounts/kube-system/cronjob-controller
/registry/serviceaccounts/kube-system/daemon-set-controller
/registry/serviceaccounts/kube-system/default
/registry/serviceaccounts/kube-system/deployment-controller
/registry/serviceaccounts/kube-system/disruption-controller
/registry/serviceaccounts/kube-system/endpoint-controller
/registry/serviceaccounts/kube-system/endpointslice-controller
/registry/serviceaccounts/kube-system/expand-controller
/registry/serviceaccounts/kube-system/generic-garbage-collector
/registry/serviceaccounts/kube-system/horizontal-pod-autoscaler
/registry/serviceaccounts/kube-system/job-controller
/registry/serviceaccounts/kube-system/kube-proxy
/registry/serviceaccounts/kube-system/namespace-controller
/registry/serviceaccounts/kube-system/node-controller
/registry/serviceaccounts/kube-system/persistent-volume-binder
/registry/serviceaccounts/kube-system/pod-garbage-collector
/registry/serviceaccounts/kube-system/pv-protection-controller
/registry/serviceaccounts/kube-system/pvc-protection-controller
/registry/serviceaccounts/kube-system/replicaset-controller
/registry/serviceaccounts/kube-system/replication-controller
/registry/serviceaccounts/kube-system/resourcequota-controller
/registry/serviceaccounts/kube-system/service-account-controller
/registry/serviceaccounts/kube-system/service-controller
/registry/serviceaccounts/kube-system/statefulset-controller
/registry/serviceaccounts/kube-system/token-cleaner
/registry/serviceaccounts/kube-system/ttl-controller
/registry/serviceaccounts/tigera-operator/default
/registry/serviceaccounts/tigera-operator/tigera-operator
/registry/services/endpoints/calico-system/calico-kube-controllers-metrics
/registry/services/endpoints/calico-system/calico-typha
/registry/services/endpoints/default/kubernetes
/registry/services/endpoints/kube-system/kube-controller-manager
/registry/services/endpoints/kube-system/kube-dns
/registry/services/endpoints/kube-system/kube-scheduler
/registry/services/specs/calico-system/calico-kube-controllers-metrics
/registry/services/specs/calico-system/calico-typha
/registry/services/specs/default/kubernetes
/registry/services/specs/kube-system/kube-dns

如果需要查看key中的数据可以使用如下命令,例如我需要查看/registry/secrets/default/default-token-cvc2p这个key中的数据

etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key get /registry/secrets/default/default-token-cvc2p

微信截图_20220608101146.png

前面我们可以看到使用etcdctl命令需要调用到相关证书,如果etcd使用的不是默认端口,我们在使用命令时还需要添加endpoint参数--endpoints=https://127.0.0.1:2379

整个命令就修改为如下

etcdctl --endpoints=https://127.0.0.1:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key get / --prefix --keys-only


内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://sulao.cn/post/849.html