Etcdctl backup - permission denied exception

Cluster information:

Kubernetes version: 1.18
Cloud being used: bare-metal
Installation method: kubeadm
Host OS: Ubuntu 18.04
CNI and version: weave-net
CRI and version: docker

Hello I am trying to backup etcd cluster using the following command:

ETCDCTL_API=3 etcdctl --cacert="/etc/kubernetes/pki/etcd/ca.crt" --cert="/etc/kubernetes/pki/etcd/server.crt" --key="/etc/kubernetes/pki/etcd/server.key" --endpoints=“https://127.0.0.1:2379” snapshot save /var/lib/etcd/backup.db
but I am getting
Error: open /etc/kubernetes/pki/etcd/server.crt: permission denied

I have also tried with sudo but no progress. Any help would be greatly appreciated.

Thanks,
Anil

It works for me when the etcdctl version installed on my master ndode matches the etcdctl version of the etcd-master pod

Hi!
I had the same error. Now It’s working.
The trick is to install etcdctl with the command
sudo apt install etcd-client
not with the command
sudo snap install etcd

I hope it will work for you too.

2 Likes

This was the case for me too, but that in turn could be the version of etcdctl - the ‘snap install’ method installs a newer version (v3.5 I think) compared to apt-get (v3.24). Running the command inside the etcd pod itself (kubectl exec -it) was a good test that my syntax was correct.

thank you, sudo snap install etcd was my issue
sudo apt install etcd-client resolved it

1 Like