3

Silly question. Just setup a 4 node kubernetes cluster (one master node). The etcd pod is running in the kube-system. But I can not find the etcdctl in regular path.

# find / -name etcdctl -print
/var/lib/docker/overlay2/9c0f2f2ef864f3be6f4195cbcda59b712805fc1957204b97d36a9239e3adb1cf/diff/usr/local/bin/etcdctl
/var/lib/docker/overlay2/bf2ff1f903bef67c6ed8ddf0b37cc6a90788974f61275df5d5fe3d9bdaca232c/merged/usr/local/bin/etcdctl

Used the found etcdctl to take snapshot but it's hung. Do I need to install etcdctl? Thanks!

halfelf
  • 9,737
  • 13
  • 54
  • 63
TJS
  • 31
  • 2

1 Answers1

3

If you are new to docker, what you have found is the volume mount for the etcd container, and inside that container is the etcdctl binary that is designed for use with the etcd binary inside the container.

You will want to docker exec into the container so you will have access to all the environment variables, config files, hostnames, etc that would be required to interact with etcd. Their documentation shows an example of using docker exec.

The fine manual also describes that you will want to ensure the ETCDCTL_API environment variable is correctly set while using etcdctl.

mdaniel
  • 31,240
  • 5
  • 55
  • 58
  • So to backup the kubernetes etcd, I'll need to exec -it to the etcd container to run the etcdctl command? I tried to use the master node public IP address as the endpoint IP but get connection closed error when running etcdctl inside the container. – TJS Feb 06 '20 at 12:46
  • You can backup etcd with etctl using ETCDTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \ you can find more information on [Kubernetes Community](https://discuss.kubernetes.io/t/etcd-backup-and-restore-management/11019) – Milad Tabrizi Oct 26 '20 at 23:50