etcdutl --data-dir
etcdutl --data-dir <new-empty-dir> snapshot restore <file>
Risk: Can lose work
What it does
Unpacks a snapshot into a new data folder. Point etcd at it, and the cluster goes back in time. Newer objects are lost.
When to use it
The last resort, when objects are lost and Git can't bring them back.
Example
$ etcdutl --data-dir /var/lib/etcd-restore snapshot restore /opt/backup.dbRestore the copy into a new folder, never the live one.
$ sed -i 's#/var/lib/etcd$#/var/lib/etcd-restore#' /etc/kubernetes/manifests/etcd.yamlThen point etcd's static pod at that folder. The kubelet restarts etcd.
Learn it in: etcd backup and restore · Official docs