Merge pull request #277 from chaosky/etcdctl

完善 etcdctl 命令行参数
pull/279/head
Jimmy Song 2018-08-29 20:21:56 +08:00 committed by GitHub
commit 73e3ef332e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -6,6 +6,15 @@ Kubenretes1.6中使用etcd V3版本的API使用`etcdctl`直接`ls`的话只
ETCDCTL_API=3 etcdctl get /registry/namespaces/default -w=json|python -m json.tool
```
如果是使用 kubeadm 创建的集群,在 Kubenretes 1.11 中etcd 默认使用 tls ,这时你可以在 master 节点上使用以下命令来访问 etcd
```bash
ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/peer.crt \
--key=/etc/kubernetes/pki/etcd/peer.key \
get /registry/namespaces/default -w=json | jq .
```
- `-w`指定输出格式
将得到这样的json的结果