error running etcd in minikube

when I am trying to run etcdctl in minikube, there has been an exception:

commands:

ETCDCTL_API=3 etcdctl get "" --prefix=true
ETCDCTL_API=3 etcdctl get "" --from-key

Exception

{"level":"warn","ts":"2020-05-01T09:32:07.933Z","caller":"clientv3/retry_interceptor.go:61","msg":"retrying of unary invoker failed","target":"endpoint://client-ea0c78af-0a9d-4092-8722-75fed707e112/127.0.0.1:2379","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest connection error: connection closed"}
Error: context deadline exceeded

the solution is to provide the needed ca files

ETCDCTL_API=3 etcdctl get "" --prefix=true --cacert=/var/lib/minikube/certs/etcd/ca.crt --cert=/var/lib/minikube/certs/etcd/server.crt --key=/var/lib/minikube/certs/etcd/server.key

the cert can be found by running

kubectl get pod etcd-minikube -n kube-system -o yaml

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s