Belajar Sendiri

Commands

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.db

Restore the copy into a new folder, never the live one.

$ sed -i 's#/var/lib/etcd$#/var/lib/etcd-restore#' /etc/kubernetes/manifests/etcd.yaml

Then point etcd's static pod at that folder. The kubelet restarts etcd.