#查看etcd pod kubectl get pod -n kube-system | grep etcd
#进入etcd pod kubectl exec -it -n kube-system etcd-node1.com sh
#设置etcdctl 使用的版本,k8s中使用v3版本
export ETCDCTL_API=3
#查询etcd中所有的key
etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthche
ck-client.key get / --prefix --keys-only
/ # ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthch eck-client.crt --key=/etc/kubernetes/pki/etcd/healthcheck-client.key get / --prefix --keys-only /registry/apiregistration.k8s.io/apiservices/v1. /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.networking.k8s.io /registry/apiregistration.k8s.io/apiservices/v1.rbac.authorization.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.apps /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.events.k8s.io /registry/apiregistration.k8s.io/apiservices/v1beta1.extensions /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/v1beta2.apps /registry/apiregistration.k8s.io/apiservices/v2beta1.autoscaling /registry/clusterrolebindings/cluster-admin /registry/clusterrolebindings/flannel /registry/clusterrolebindings/heapster /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/kubernetes-dashboard /registry/clusterrolebindings/myname-cluster-admin-binding /registry/clusterrolebindings/nginx-ingress-clusterrole-nisa-binding /registry/clusterrolebindings/system:aws-cloud-provider /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: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:volume-scheduler /registry/clusterroles/admin /registry/clusterroles/cluster-admin /registry/clusterroles/edit /registry/clusterroles/flannel /registry/clusterroles/nginx-ingress-clusterrole /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:aws-cloud-provider /registry/clusterroles/system:basic-user /registry/clusterroles/system:certificates.k8s.io:certificatesigningrequests:nodeclient /registry/clusterroles/system:certificates.k8s.io:certificatesigningrequests:selfnodeclient /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: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:csi-external-attacher /registry/clusterroles/system:csi-external-provisioner /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:volume-scheduler /registry/clusterroles/view /registry/configmaps/kube-public/cluster-info /registry/configmaps/kube-system/coredns /registry/configmaps/kube-system/extension-apiserver-authentication /registry/configmaps/kube-system/ingress-controller-leader-nginx /registry/configmaps/kube-system/kube-flannel-cfg /registry/configmaps/kube-system/kube-proxy /registry/configmaps/kube-system/kubeadm-config /registry/configmaps/kube-system/kubelet-config-1.11 /registry/configmaps/kube-system/kubernetes-dashboard-settings /registry/controllerrevisions/kube-system/kube-flannel-ds-76dc9b4577 /registry/controllerrevisions/kube-system/kube-proxy-799497d975 /registry/daemonsets/kube-system/kube-flannel-ds /registry/daemonsets/kube-system/kube-proxy /registry/deployments/default/file-server /registry/deployments/default/my-2048-game /registry/deployments/default/nginx-deployment /registry/deployments/default/wordpress /registry/deployments/dev/nginx-deployment /registry/deployments/kube-system/coredns /registry/deployments/kube-system/default-http-backend /registry/deployments/kube-system/heapster /registry/deployments/kube-system/kubernetes-dashboard /registry/deployments/kube-system/monitoring-grafana /registry/deployments/kube-system/monitoring-influxdb /registry/deployments/kube-system/nginx-ingress-controller /registry/deployments/prod/my-2048-game /registry/deployments/vnc/centos-vnc /registry/ingress/default/my2048-ingress /registry/ingress/default/wordpress-ingress /registry/ingress/kube-system/grafana-heapster-ingress /registry/ingress/vnc/centos-vnc-ingress /registry/masterleases/172.31.2.130 /registry/minions/harbor /registry/minions/node1.com /registry/minions/node2.com /registry/namespaces/default /registry/namespaces/dev /registry/namespaces/kube-public /registry/namespaces/kube-system /registry/namespaces/prod /registry/namespaces/vnc /registry/pods/default/file-server-c996dd78d-5x5ks /registry/pods/default/file-server-c996dd78d-8w4x7 /registry/pods/default/file-server-c996dd78d-vmg9k /registry/pods/default/my-2048-game-789f4fb6b5-ln8md /registry/pods/default/my-2048-game-789f4fb6b5-rjhj2 /registry/pods/default/my-2048-game-789f4fb6b5-sntnz /registry/pods/default/nginx-deployment-67594d6bf6-jxsml /registry/pods/default/nginx-deployment-67594d6bf6-rg62t /registry/pods/default/nginx-deployment-67594d6bf6-wrmrk /registry/pods/default/wordpress-8446c9cf6-f6tsp /registry/pods/default/wordpress-8446c9cf6-l8sxg /registry/pods/default/wordpress-8446c9cf6-t6c27 /registry/pods/dev/nginx-deployment-67594d6bf6-hhj65 /registry/pods/dev/nginx-deployment-67594d6bf6-wdgfx /registry/pods/dev/nginx-deployment-67594d6bf6-wqcvl /registry/pods/kube-system/coredns-78fcdf6894-5bwc7 /registry/pods/kube-system/coredns-78fcdf6894-x79ww /registry/pods/kube-system/default-http-backend-784cf5f7b5-p9mcd /registry/pods/kube-system/etcd-node1.com /registry/pods/kube-system/heapster-94b5876d8-bfr9n /registry/pods/kube-system/kube-apiserver-node1.com /registry/pods/kube-system/kube-controller-manager-node1.com /registry/pods/kube-system/kube-flannel-ds-8zcwd /registry/pods/kube-system/kube-flannel-ds-fmngg /registry/pods/kube-system/kube-flannel-ds-gldqx /registry/pods/kube-system/kube-proxy-8gp2k /registry/pods/kube-system/kube-proxy-szb9p /registry/pods/kube-system/kube-proxy-tq7d7 /registry/pods/kube-system/kube-scheduler-node1.com /registry/pods/kube-system/monitoring-grafana-555545f477-wwtfc /registry/pods/kube-system/monitoring-influxdb-56b597d5c5-fklp2 /registry/pods/kube-system/nginx-ingress-controller-84b8b6df66-46848 /registry/pods/prod/my-2048-game-789f4fb6b5-6nl8n /registry/pods/prod/my-2048-game-789f4fb6b5-j59hq /registry/pods/prod/my-2048-game-789f4fb6b5-xx2vb /registry/pods/vnc/centos-vnc-6b78b444cb-78b4p /registry/pods/vnc/centos-vnc-6b78b444cb-k8cbk /registry/pods/vnc/centos-vnc-6b78b444cb-tzz6h /registry/priorityclasses/system-cluster-critical /registry/priorityclasses/system-node-critical /registry/ranges/serviceips /registry/ranges/servicenodeports /registry/replicasets/default/file-server-56d5768d64 /registry/replicasets/default/file-server-67599974c /registry/replicasets/default/file-server-6f8d766c4c /registry/replicasets/default/file-server-757c55c4b5 /registry/replicasets/default/file-server-c996dd78d /registry/replicasets/default/my-2048-game-789f4fb6b5 /registry/replicasets/default/nginx-deployment-67594d6bf6 /registry/replicasets/default/wordpress-8446c9cf6 /registry/replicasets/dev/nginx-deployment-67594d6bf6 /registry/replicasets/kube-system/coredns-78fcdf6894 /registry/replicasets/kube-system/default-http-backend-64fbd8d86b /registry/replicasets/kube-system/default-http-backend-784cf5f7b5 /registry/replicasets/kube-system/default-http-backend-79688b458 /registry/replicasets/kube-system/heapster-5f448ddd75 /registry/replicasets/kube-system/heapster-84c9bc48c4 /registry/replicasets/kube-system/heapster-94b5876d8 /registry/replicasets/kube-system/heapster-b66cc49c9 /registry/replicasets/kube-system/kubernetes-dashboard-55cb6ff5d8 /registry/replicasets/kube-system/kubernetes-dashboard-5dc976bbb6 /registry/replicasets/kube-system/kubernetes-dashboard-785dc75899 /registry/replicasets/kube-system/kubernetes-dashboard-b644d546b /registry/replicasets/kube-system/monitoring-grafana-555545f477 /registry/replicasets/kube-system/monitoring-influxdb-56b597d5c5 /registry/replicasets/kube-system/monitoring-influxdb-848b9b66f6 /registry/replicasets/kube-system/nginx-ingress-controller-6b689b677c /registry/replicasets/kube-system/nginx-ingress-controller-7468c988fd /registry/replicasets/kube-system/nginx-ingress-controller-764bc95d75 /registry/replicasets/kube-system/nginx-ingress-controller-84b8b6df66 /registry/replicasets/prod/my-2048-game-789f4fb6b5 /registry/replicasets/vnc/centos-vnc-6b78b444cb /registry/replicasets/vnc/centos-vnc-6d6f7d995b /registry/replicasets/vnc/centos-vnc-79d64c566c /registry/rolebindings/kube-public/kubeadm:bootstrap-signer-clusterinfo /registry/rolebindings/kube-public/system:controller:bootstrap-signer /registry/rolebindings/kube-system/kubeadm:kubelet-config-1.11 /registry/rolebindings/kube-system/kubernetes-dashboard-minimal /registry/rolebindings/kube-system/nginx-ingress-role-nisa-binding /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/kubeadm:kubelet-config-1.11 /registry/roles/kube-system/kubernetes-dashboard-minimal /registry/roles/kube-system/nginx-ingress-role /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/default/default-token-8gfqd /registry/secrets/dev/default-token-msmn2 /registry/secrets/kube-public/default-token-nzxfk /registry/secrets/kube-system/attachdetach-controller-token-td9wn /registry/secrets/kube-system/bootstrap-signer-token-792zx /registry/secrets/kube-system/certificate-controller-token-zvzbg /registry/secrets/kube-system/clusterrole-aggregation-controller-token-55jxn /registry/secrets/kube-system/coredns-token-7c969 /registry/secrets/kube-system/cronjob-controller-token-f6l48 /registry/secrets/kube-system/daemon-set-controller-token-vll7s /registry/secrets/kube-system/default-token-wzc9x /registry/secrets/kube-system/deployment-controller-token-5x5pr /registry/secrets/kube-system/disruption-controller-token-wq4pl /registry/secrets/kube-system/endpoint-controller-token-lppdn /registry/secrets/kube-system/expand-controller-token-ztwbf /registry/secrets/kube-system/flannel-token-cv7ns /registry/secrets/kube-system/generic-garbage-collector-token-qd77g /registry/secrets/kube-system/heapster-token-l86rd /registry/secrets/kube-system/horizontal-pod-autoscaler-token-wr89w /registry/secrets/kube-system/job-controller-token-fdz4s /registry/secrets/kube-system/kube-proxy-token-67qq2 /registry/secrets/kube-system/kubernetes-dashboard-certs /registry/secrets/kube-system/kubernetes-dashboard-key-holder /registry/secrets/kube-system/kubernetes-dashboard-token-kzskq /registry/secrets/kube-system/namespace-controller-token-7g9hz /registry/secrets/kube-system/nginx-ingress-serviceaccount-token-wk7qn /registry/secrets/kube-system/node-controller-token-l79zz /registry/secrets/kube-system/persistent-volume-binder-token-fmcvj /registry/secrets/kube-system/pod-garbage-collector-token-znhqv /registry/secrets/kube-system/pv-protection-controller-token-7znm7 /registry/secrets/kube-system/pvc-protection-controller-token-b4pdl /registry/secrets/kube-system/replicaset-controller-token-js7pw /registry/secrets/kube-system/replication-controller-token-bms7t /registry/secrets/kube-system/resourcequota-controller-token-498vv /registry/secrets/kube-system/service-account-controller-token-8tmzt /registry/secrets/kube-system/service-controller-token-hhrwb /registry/secrets/kube-system/statefulset-controller-token-j9st2 /registry/secrets/kube-system/token-cleaner-token-8csjg /registry/secrets/kube-system/ttl-controller-token-nss47 /registry/secrets/prod/default-token-g7gvk /registry/secrets/vnc/default-token-2m2s5 /registry/serviceaccounts/default/default /registry/serviceaccounts/dev/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/expand-controller /registry/serviceaccounts/kube-system/flannel /registry/serviceaccounts/kube-system/generic-garbage-collector /registry/serviceaccounts/kube-system/heapster /registry/serviceaccounts/kube-system/horizontal-pod-autoscaler /registry/serviceaccounts/kube-system/job-controller /registry/serviceaccounts/kube-system/kube-proxy /registry/serviceaccounts/kube-system/kubernetes-dashboard /registry/serviceaccounts/kube-system/namespace-controller /registry/serviceaccounts/kube-system/nginx-ingress-serviceaccount /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/prod/default /registry/serviceaccounts/vnc/default /registry/services/endpoints/default/file-server /registry/services/endpoints/default/kubernetes /registry/services/endpoints/default/my-2048-game /registry/services/endpoints/default/nginx-deployment /registry/services/endpoints/kube-system/default-http-backend /registry/services/endpoints/kube-system/heapster /registry/services/endpoints/kube-system/kube-controller-manager /registry/services/endpoints/kube-system/kube-dns /registry/services/endpoints/kube-system/kube-scheduler /registry/services/endpoints/kube-system/kubernetes-dashboard /registry/services/endpoints/kube-system/monitoring-grafana /registry/services/endpoints/kube-system/monitoring-influxdb /registry/services/endpoints/vnc/centos-vnc /registry/services/specs/default/file-server /registry/services/specs/default/kubernetes /registry/services/specs/default/my-2048-game /registry/services/specs/default/nginx-deployment /registry/services/specs/kube-system/default-http-backend /registry/services/specs/kube-system/heapster /registry/services/specs/kube-system/kube-dns /registry/services/specs/kube-system/kubernetes-dashboard /registry/services/specs/kube-system/monitoring-grafana /registry/services/specs/kube-system/monitoring-influxdb /registry/services/specs/vnc/centos-vnc
#查询指定key的数据,如/registry/services/specs/default/nginx-deployment的数据
etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/healthcheck-client.crt --key=/etc/kubernetes/pki/etcd/healthche ck-client.key get /registry/services/specs/default/nginx-deployment --prefix
看起来有点乱码----冏
所有评论(0)