ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

一次etcd查看数据的报错

2020-03-24 20:55:41  阅读:361  来源: 互联网

标签:file 查看 ca etcd 报错 key k8s etcdctl


使用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,如下

[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=""的选项,这些信息已经在命令执行错误的提示信息中有提示了,没有仔细的查看,哎哎,因为这个问题耽误了许多的时间,真是太不值当的,以后要相信自己,仔细观察日志。


etcdctl的版本为: VERSION:3.4.3   API=3 的环境下

最终执行的信息:

[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下查看:

kubectl exec -it  -n kube-system  etcd-k8s-3  -- etcdctl --ca-file=xxxxx --cert-file=/xxx   --key-file=xxxxx \



标签:file,查看,ca,etcd,报错,key,k8s,etcdctl
来源: https://blog.51cto.com/12182612/2481493

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有