Check first if this is similar to this question
I forgot to set $ENDPOINT
.
That can happen if the --endpoints
flag is not correctly followed by an actual endpoint.
In your case, because of the lack of a specified endpoint after the --endpoints
flag, etcdctl
is 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:
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>
Do replace <trusted-ca-file>
, <cert-file>
, <key-file>
, and <backup-file-location>
with your actual file paths.
The --endpoints
flag 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 the etcdctl
does 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 the etcdctl
command has permission to write to it.