<p>Is there a good way to access the etcd datastore of a minikube cluster? I'm trying to create a watcher for events on kubernetes pods, but I need to look at the etcd changelog. So far, I have run <code>kubectl exec -it --namespace kube-system etcd-minikube sh</code>, which ssh-s me into the minikube host machine, but from there, I can't access <code>etcd</code>, <code>etcdctl</code> times out, and I can't even run <code>python</code>. Is there a clean way to do this? The links seem outdated.</p>

<p><a href="https://github.com/kubernetes/minikube/blob/master/docs/accessing_etcd.md" rel="nofollow noreferrer">https://github.com/kubernetes/minikube/blob/master/docs/accessing_etcd.md</a> is outdated, as well as any other sources that reference localkube.</p>

<p>I was able to check minikube <a href="https://github.com/kubernetes/minikube/releases/tag/v1.2.0" rel="nofollow noreferrer">v1.2.0</a> etcd v3 connection channel through <a href="https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/api_grpc_gateway.md" rel="nofollow noreferrer">gRPC</a> messaging protocol and it works fine.</p>

<p>I've check connection in two ways: directly within <code>etcd-minikube</code> Pod and externally from my minikube hosting machine via <a href="https://github.com/etcd-io/etcd/releases" rel="nofollow noreferrer">etcdctl</a> binary injected there.</p>

<p>Minikube <a href="https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/" rel="nofollow noreferrer">ETCD</a> certificates inventory located here: <code>/var/lib/minikube/certs/etcd/</code> and I've used some of these certs to authenticate to etcd storage.</p>

<p>You can use below query string for connection from within <code>etcd-minikube</code> Pod, but first you have to distribute etcd certs into this Pod; this can be done via <code>kubectl cp</code> command:</p>

<p><code>sudo kubectl cp /var/lib/minikube/certs/etcd/ etcd-minikube:/SOME_PATH -n kube-system</code></p>

<p><code>ETCDCTL_API=3 etcdctl --cacert=/PATH/TO/ETCD/CERTS/ca.crt --key=/PATH/TO/ETCD/CERTS/server.key --cert=/PATH/TO/ETCD/CERTS/server.crt  get  / --prefix --keys-only</code></p>

<p>Query string from my minikube host machine accessing etcd endpoint:</p>

<p><code>ETCDCTL_API=3 etcdctl --cacert=/PATH/TO/ETCD/CERTS/ca.crt --key=/PATH/TO/ETCD/CERTS/server.key --cert=/PATH/TO/ETCD/CERTS/server.crt --endpoints "https://$(minikube ip):2379" get  / --prefix --keys-only</code></p>
