Etcdctl exec gives error

Hello,

I am following CKA course. In etcd example video shows to run following command :

kubectl exec etcd-master -n kube-system etcdctl get / --prefix -keys-only

but I am getting error as Error: unknown flag: --prefix.

May I know if I am doing something wrong here. Attached is the screenshot from course video and my environment.


Thanks
Ashish

Hello @06ashishrawat
Let me know.
kubectl exec etcd-master -n kube-system – etcdctl get / --prefix --keys-only

Hello @Tej-Singh-Rana here is the output :

[root@master ~]# kubectl exec etcd-master -n kube-system – etcdctl get / --prefix --keys-only
Error: unknown flag: --prefix
See ‘kubectl exec --help’ for usage.
[root@master ~]#

Thanks
Ashish

Where you are performing this?

In my k8s cluster, it’s a three node cluster.1 master and 2 worker.

here is the details :

[root@master ~]# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
master Ready master 47d v1.18.6 192.168.120.220 CentOS Linux 7 (Core) 3.10.0-1127.13.1.el7.x86_64 docker://1.13.1
worker-1 Ready 47d v1.18.6 192.168.120.221 CentOS Linux 7 (Core) 3.10.0-1127.13.1.el7.x86_64 docker://1.13.1
worker-2 Ready 47d v1.18.6 192.168.120.222 CentOS Linux 7 (Core) 3.10.0-1127.13.1.el7.x86_64 docker://1.13.1
[root@master ~]#

Thanks
Ashish

kubectl exec etcd-master -n kube-system -- etcdctl get / --prefix --keys-only --cacert /etc/kubernetes/pki/etcd/ca.crt --key /etc/kubernetes/pki/etcd/server.key --cert /etc/kubernetes/pki/etcd/server.crt
ETCDCTL_API='3' etcdctl get / --prefix --keys-only \
--cacert /etc/kubernetes/pki/etcd/ca.crt \
--key /etc/kubernetes/pki/etcd/server.key \
--cert /etc/kubernetes/pki/etcd/server.crt \
--endpoints=127.0.0.1:2379

Try from your terminal without mention, etcd-master Pod.

This one is working :

[root@master ~]# kubectl exec etcd-master -n kube-system – etcdctl get / --prefix --keys-only --cacert /etc/kubernetes/pki/etcd/ca.crt --key /etc/kubernetes/pki/etcd/server.key --cert /etc/kubernetes/pki/etcd/server.crt
/registry/apiregistration.k8s.io/apiservices/v1.

/registry/apiregistration.k8s.io/apiservices/v1.admissionregistration.k8s.io

Thanks, at this point I won’t ask how and why :slight_smile: I am sure in future topics all this will get clear.

As usual, thanks a lot for your great support all the time.

It should be work. But continue new releases and bug fixes. So they changed process time to time. To make it more secure.

great, thanks a lot for clarification…