# Backing up etcd: the snapshot that saves a cluster

> Take an etcdctl snapshot on a schedule, restore it with etcdutl into a new data directory, and know what it never held: volume data, certificates and the encryption key. Why EKS, GKE and AKS need an API-level backup instead.

- Canonical: https://www.alpacamango.com/docs/etcd-backup-and-restore
- Author: Zorp
- Published: 2026-11-26 · Updated: 2026-11-20
- Topics: Kubernetes, DevOps

**If you run your own control plane, take an ****`etcdctl snapshot save`**** on a schedule, copy it off the node, and practise the restore before you need it: unpack the file with ****`etcdutl`**** into a fresh directory and point the etcd static Pod at it. If your cluster is EKS, GKE or AKS, you cannot do any of this, and your backup has to work through the Kubernetes API instead.** Either way, know what the snapshot leaves out.

*Based on the article from Gazeek, our sister site for hands-on CKA and CKAD labs: *[*etcd backup and restore in Kubernetes, step by step*](https://gazeek.com/blog/etcd-backup-and-restore-for-the-cka?utm_source=alpacamango)*. Every command, the certificate flags and a troubleshooting list for a restore that will not start are there.*

## A snapshot is the cluster's memory, not its data

etcd stores every object the API server knows about, from Deployments to Secrets to RBAC rules. Restoring a snapshot makes the API server believe exactly what it believed at that moment.

That is a record of intent. It does not contain:

- **What is on your volumes.** A PersistentVolume object comes back; the bytes on the disk behind it were never in etcd. Database files need their own backup.
- **The control plane's files.** The certificates under `/etc/kubernetes/pki` and the static Pod manifests live on the node's disk. Lose the node and the snapshot alone will not rebuild it.
- **The encryption key.** By default the API server writes Secrets to etcd as plain text, so the snapshot file is as sensitive as the cluster's admin credentials. If you turned on encryption at rest, the snapshot holds ciphertext, and the key sits in a configuration file on the control plane node. Back up one without the other and your Secrets are either exposed or unreadable.

## Restoring rewinds the cluster, not the world

After a restore, the controllers wake up and reconcile towards the old state. A Deployment rolled out yesterday goes back to last week's image. A Service of type LoadBalancer created after the snapshot vanishes from the API, but the cloud load balancer its controller made may still be running and billing, because nothing in the restored cluster knows it exists. Dynamically provisioned disks can be orphaned the same way.

So a restore is the last resort for a lost or corrupted control plane, not an undo button for a bad release. For a bad release, roll back the release.

## The restore that actually works

The Kubernetes documentation gives the order: stop every API server, restore etcd, start the API servers again. It also recommends restarting the scheduler, the controller manager and the kubelets so none of them acts on cached state from before the restore. On a kubeadm control plane those are static Pods, so you stop one by moving its manifest out of `/etc/kubernetes/manifests` and start it by moving it back. The exam usually gets away with less on a single node; production should not.

Take and check the snapshot with the two tools that now split the job: `etcdctl` talks to the running server, `etcdutl` works on files. The `snapshot status` and `snapshot restore` subcommands of `etcdctl` were deprecated in etcd 3.5 and removed in 3.6.

```bash
etcdctl --endpoints=https://127.0.0.1:2379 --cacert=… --cert=… --key=… \
  snapshot save /backup/etcd.db
etcdutl snapshot status /backup/etcd.db -w table
etcdutl snapshot restore /backup/etcd.db --data-dir /var/lib/etcd-restored
```

Restore into a directory that does not exist yet. The restore gives the member a new cluster identity, which is why it cannot rejoin the old cluster and why every member of a multi-node etcd has to be restored from the same file. Then change the `etcd-data` volume in `/etc/kubernetes/manifests/etcd.yaml` to the new path and let the kubelet restart the Pod.

One step that is easy to miss: on kubeadm, also set `etcd.local.dataDir` in the `kubeadm-config` ConfigMap. If you do not, the next `kubeadm upgrade` writes a fresh etcd manifest pointing at the old directory, and the cluster comes up with the state it had before your restore.

## Why managed clusters hide this

On EKS, AWS runs three etcd instances across three availability zones and replaces them when they fail. GKE and AKS likewise keep etcd out of your reach. That protects you from losing the control plane, but not from deleting a namespace by mistake: the provider will faithfully keep the deletion. On a managed cluster, back up through the API with a tool such as Velero, Backup for GKE or Azure Backup for AKS, which also snapshot the volumes that etcd never held. On your own control plane, do both: etcd for the cluster, and an API-level or storage-level backup for the data.

A restore is worth rehearsing on a cluster you can afford to wreck. Gazeek's [CKA module on upgrades and etcd](https://gazeek.com/courses/cka?utm_source=alpacamango#module-02-upgrades-and-etcd) gives you one. For where etcd sits among the other components, see [Kubernetes architecture, one component at a time](/docs/kubernetes-architecture-explained); for the commands that make the rest of the exam faster, [kubectl habits that save minutes](/docs/kubectl-aliases).

## The diagram

The backup path from the etcd static Pod to off-node storage, the restore path into a new data directory, and what the snapshot never held. [Open it in archhy](https://archhy.com/d/tMXSumjVSsMX?utm_source=alpacamango) and press Make a copy to adapt it.

## Go deeper

Gazeek's [full article](https://gazeek.com/blog/etcd-backup-and-restore-for-the-cka?utm_source=alpacamango) walks through reading the certificate paths from the manifest, the snapshot, the restore and the manifest edit on a kubeadm cluster, with what to check when etcd does not come back.
