Challenge, Medium,  on  Kubernetes

Take and Restore an etcd Snapshot on a Kubernetes Cluster

Scenario

You are a Kubernetes administrator responsible for the cluster's operational health.

As part of routine maintenance and practice, you need to create an etcd snapshot backup and restore it to verify that the backup is usable.

Task

Two tasks need to be completed:

Task 1
Task 2

Take a snapshot backup of the running etcd instance and save it to:

/home/laborant/etcd-backup/etcd-snapshot.db
Hint 1 — Taking an etcd Snapshot

Use etcdctl snapshot save (not etcdutl) and point to the output file path. This requires a live connection to a running etcd instance — the snapshot is streamed over the network via the etcd API.

You will need the etcd TLS certificates, which are located under /etc/kubernetes/pki/etcd/.

You can find the exact flags used by the running etcd pod by inspecting its manifest at /etc/kubernetes/manifests/etcd.yaml.

Run etcdctl snapshot save --help to see all available flags — you will need to specify --endpoints to point to the etcd server address, along with TLS flags like --cacert, --cert, and --key for secure authentication.

Documentation

Restore the snapshot you just created into the directory:

/home/laborant/etcd-restore

In etcd v3.6+, etcdctl snapshot restore no longer exists — the restore subcommand was moved to etcdutl. Use etcdutl snapshot restore instead.

Hint 2 — Restoring an etcd Snapshot

Use etcdutl snapshot restore (not etcdctl) and point --data-dir to the target path. This is a file-only operation — safe to run against a live cluster.

Run etcdutl snapshot restore --help to see all available flags — the --data-dir flag specifies where to restore the snapshot.

Documentation


💡 Test Cases