使用kubeadm安裝k8s集羣后,想要查看etcd中關於k8s集羣的信息,可是使用kubectl exec xxx -- etcdctl --ca-file xxx --cert-file xxxx --key-file xxx endpoints https:127.0.0.1:2379 member list提示Error: unknown flag: --ca-file,以下json
[root@k8s-3 manifests]# kubectl exec -it -n kube-system etcd-k8s-3 \ > -- etcdctl \ > --ca-file=/etc/kubernetes/pki/etcd/ca.crt \ > --cert-file=/etc/kubernetes/pki/etcd/peer.crt \ > --key-file=/etc/kubernetes/pki/etcd/peer.key \ > member list Error: unknown flag: --ca-file NAME: member list - Lists all members in the cluster USAGE: etcdctl member list [flags] DESCRIPTION: When --write-out is set to simple, this command prints out comma-separated member lists for each endpoint. The items in the lists are ID, Status, Name, Peer Addrs, Client Addrs, Is Learner. OPTIONS: -h, --help[=false]help for list GLOBAL OPTIONS: --cacert=""verify certificates of TLS-enabled secure servers using this CA bundle --cert=""identify secure client using this TLS certificate file --command-timeout=5stimeout for short running command (excluding dial timeout) --debug[=false]enable client-side debug logging --dial-timeout=2sdial timeout for client connections -d, --discovery-srv=""domain name to query for SRV records describing cluster endpoints --discovery-srv-name=""service name to query when using DNS discovery --endpoints=[127.0.0.1:2379]gRPC endpoints --hex[=false]print byte strings as hex encoded strings --insecure-discovery[=true]accept insecure SRV records describing cluster endpoints --insecure-skip-tls-verify[=false]skip server certificate verification --insecure-transport[=true]disable transport security for client connections --keepalive-time=2skeepalive time for client connections --keepalive-timeout=6skeepalive timeout for client connections --key=""identify secure client using this TLS key file --password=""password for authentication (if this option is used, --user option shouldn't include password) --user=""username[:password] for authentication (prompt if password is not supplied) -w, --write-out="simple"set the output format (fields, json, protobuf, simple, table) Error: unknown flag: --ca-file command terminated with exit code 1
提示不識別--ca-file,其實以上的信息已經提示到問題的切入點了,可是感受太依賴百度了,沒有仔細的查看提示信息,在網上收搜了不少信息,操做了不少仍是同樣的報錯,最後忽然醒悟,查看了etcdctl的幫助,看到了 --cacert="",--cert="",--key=""的選項,這些信息已經在命令執行錯誤的提示信息中有提示了,沒有仔細的查看,哎哎,由於這個問題耽誤了許多的時間,真是太不值當的,之後要相信本身,仔細觀察日誌。bash
etcdctl的版本爲: VERSION:3.4.3 API=3 的環境下dom
最終執行的信息:ide
[root@k8s-3 manifests]# kubectl exec -it -n kube-system etcd-k8s-3 -- etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/peer.crt --key=/etc/kubernetes/pki/etcd/peer.key --endpoints https://127.0.0.1:2379 member list -w table +------------------+---------+-------+-----------------------------+-----------------------------+------------+ | ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS | IS LEARNER | +------------------+---------+-------+-----------------------------+-----------------------------+------------+ | 74cd7be96f035358 | started | k8s-3 | https://192.168.191.30:2380 | https://192.168.191.30:2379 | false | +------------------+---------+-------+-----------------------------+-----------------------------+------------+
API=2下查看:this
kubectl exec -it -n kube-system etcd-k8s-3 -- etcdctl --ca-file=xxxxx --cert-file=/xxx --key-file=xxxxx \