I have setup a kubernetes cluster with 2 master nodes and 4 worker nodes, I am trying to do an etcd backup
as described in the documentation inside my etcd container.
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 \
--cacert=<trusted-ca-file> --cert=<cert-file> --key=<key-file> \
snapshot save <backup-file-location>
but I get the following error:
Error: unknown command "save" for "etcdctl"
Are there something to concider upfront?
Check first if this is similar to this question
That can happen if the
--endpointsflag is not correctly followed by an actual endpoint.In your case, because of the lack of a specified endpoint after the
--endpointsflag,etcdctlis interpreting "snapshot" as the endpoint, and "save" as the command - which could result in the error you are seeing.A better formed command would be:
Do replace
<trusted-ca-file>,<cert-file>,<key-file>, and<backup-file-location>with your actual file paths.The
--endpointsflag specifies the endpoint to connect to your etcd server. In a Kubernetes cluster, you typically connect to the etcd server through localhost (127.0.0.1) on port 2379, which is the default etcd client port.Also, just in case, in some shells, using the
\character for line continuation might cause issues, try running the command all on one line:ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert=<trusted-ca-file> --cert=<cert-file> --key=<key-file> snapshot save <backup-file-location>Another issue might be that the
<backup-file-location>you are specifying does not exist or theetcdctldoes not have permission to write to it. Make sure the directory you are trying to save the snapshot to exists and that the user running theetcdctlcommand has permission to write to it.