Tutorial
Disaster recovery in the lab
In this tutorial, the lab loses all etcd data of a cluster and gets it back from a snapshot. The task mise run lab:backup-restore does the steps. You watch them and examine the result.
What you make
Section titled “What you make”Lose etcd and restore it
1 / 6
Back up
The operator takes an etcd snapshot, encrypts it for your age key and stores it on its backup volume.
pk-metal backup now lab-drBack up. The operator takes an etcd snapshot, encrypts it for your age key and stores it on its backup volume.
pk-metal backup now lab-drWrite after the snapshot. The task writes a second ConfigMap. The snapshot does not contain it.
kubectl create configmap dr-afterLose etcd. The task wipes the partition EPHEMERAL on each control plane. The cluster reports EtcdDataLost. The operator does not bootstrap it again.
talosctl reset --system-labels-to-wipe EPHEMERALPropose and approve. One person proposes the restore. A person approves it.
pk-metal restore plan --snapshot <name> --propose labUpload. You decrypt the snapshot on the workstation and send it to the node.
pk-metal restore upload <operation> --identity identity.txtRecovered. etcd starts from the snapshot. The first ConfigMap is back. The second ConfigMap is not.
kubectl -n default get configmaps
- An EtcdBackupPolicy and one verified EtcdSnapshot.
- A cluster that lost its etcd data and came back from the snapshot.
- Proof of the result: an object from before the snapshot is back, and an object from after it is not.
Time and prerequisites
Section titled “Time and prerequisites”- Time
- About 30 minutes.
- Before
- Your first cluster in the lab
- Lab
- Down. Step 1 starts a lab with one control plane, which is the quickest.
1. Start a lab with one control plane
Section titled “1. Start a lab with one control plane”-
If a lab runs, stop it and delete the disks.
Terminal window mise run lab:down && mise run lab:reset -
Start the lab and install the cluster.
Terminal window PK_LAB_NODES=1cp+0w mise run lab:upmise run lab:wait
2. Run the round
Section titled “2. Run the round”-
Open the live view in a second terminal.
Terminal window mise run lab:top -
Start the round in the first terminal.
Terminal window mise run lab:backup-restore -
Follow the parts in the output.
$ mise run lab:backup-restore == etcd backup volume == EtcdBackupPolicy lab-dr, a snapshot, and markers around it configmap/dr-before created configmap/dr-after created == losing etcd: wiping EPHEMERAL on every control plane of lab the operator sees the loss and does not bootstrap: ... == restoring lab-dr-manual-20260115-101502 == waiting for lab-etcd-recover-node-1 and for etcd [2026-01-15 10:19:04 UTC] lab-etcd-recover-node-1 Running: ... restored after 412s: lab is Bootstrapped from lab-dr-manual-20260115-101502; dr-before is back, dr-after is not
| Part in the output | What happens | Reference |
|---|---|---|
etcd backup volume |
The manager gets a volume for snapshots. | Manager |
EtcdBackupPolicy lab-dr, a snapshot, and markers around it |
The task makes an age key and a policy. It writes dr-before, takes a snapshot, and writes dr-after. |
pk-metal backup |
losing etcd |
talosctl reset wipes EPHEMERAL on the control plane. The TalosCluster reports EtcdDataLost. |
TalosCluster |
restoring <snapshot> |
The user lab-restorer proposes the restore. The admin approves it. The task uploads the snapshot. |
pk-metal restore |
waiting for <operation> and for etcd |
The operation with EtcdRecover runs. etcd starts from the snapshot. | HostOperation |
3. Examine the result
Section titled “3. Examine the result”-
Show the ConfigMaps in the restored cluster.
Terminal window kubectl --kubeconfig .lab/workload.kubeconfig -n default get configmapsdr-beforeis in the list.dr-afteris not. -
Show the snapshots.
Terminal window metal/bin/pk-metal --kubeconfig .lab/kubeconfig backup list lab -
Show the restore operation. Its phase is
Succeeded.Terminal window kubectl --kubeconfig .lab/kubeconfig -n pk-metal get hostoperations -
Examine the files that the task kept.
Terminal window ls .lab/backup-restore/File Contents identity.txtThe age identity. Only this key can decrypt the snapshot. snapshot.db.ageThe encrypted snapshot restorer.kubeconfigThe kubeconfig of the user lab-restorer
If a step does not give its checkpoint, see Lab troubleshooting.
What you learned
Section titled “What you learned”- The operator sees the loss of etcd data, and it does not bootstrap the cluster again without a person.
- A restore needs two persons and an approval, as each other change does: Approval.
- The operator stores only encrypted snapshots. You keep the key.
- A restore brings back the state of the snapshot. You lose later changes.