Skip to content

Workflow

Disaster recovery

A Talos cluster keeps its Kubernetes state in etcd on the control planes. If most control planes lose their etcd data, only a snapshot brings the state back. etcd backup explains the model.

Back up and restore etcd

1 / 8

The operator takes encrypted etcd snapshots into a sink. After a loss, approved operations reset the stuck members, and a person uploads the decrypted snapshot to one control plane.EtcdBackupPolicyinterval, sink, keysOperatorage encryptSink-etcd-EtcdSnapshot-Youage identityRestore operations-scheduleciphertextrestore planresetgetupload over Talos API

Back up

An EtcdBackupPolicy takes a snapshot from a healthy member on a schedule. Taking a snapshot needs no approval.

pk-metal backup now lab
  1. Back up. An EtcdBackupPolicy takes a snapshot from a healthy member on a schedule. Taking a snapshot needs no approval.

    pk-metal backup now lab
  2. Encrypt and store. The operator encrypts the snapshot to your age public keys and sends it to the sink. It holds no secret key, so it cannot read the snapshot.

    spec.encryption.ageRecipients: [age1…]
  3. Verify. The operator reads the snapshot back and checks the hash. Only a Verified snapshot can be restored.

    pk-metal backup list lab
  4. Loss. Most control planes lose their etcd data. etcd stops. The operator does not bootstrap again, because that makes an empty cluster over your data.

    Bootstrapped=False EtcdDataLost
  5. Plan. restore plan asks each control plane about etcd and prints the case. With --propose it writes a reset for each stuck member and one etcdRecover.

    pk-metal restore plan lab --propose
  6. Approve and reset. A person approves the operations one after the other. The resets wipe EPHEMERAL on the stuck control planes.

    pk-metal approve pk-metal/lab-etcd-reset-node-2
  7. Upload. You decrypt the snapshot on your workstation and stream it to the node over the Talos API. The plaintext never touches a disk or the operator.

    pk-metal restore upload pk-metal/lab-etcd-recover-node-1 --identity ~/.config/age/keys.txt
  8. Restored. Talos starts etcd on one node from the snapshot. The other control planes join it. Bootstrapped is True again.

    kubectl get taloscluster lab
  1. Make an age key pair for each person who may restore.
  2. Write an EtcdBackupPolicy with a sink and at least two age recipients.
  3. Take the first snapshot with pk-metal backup and make sure that it is Verified.
  4. When etcd fails, start with pk-metal restore plan. It changes nothing.
  5. Propose the fix with --propose. A person approves the operations, one after the other. If your site forbids self-approval, that is not the proposer.
  6. For a lost majority, upload the snapshot with pk-metal restore upload.
  7. The EtcdRecover action starts etcd from the snapshot on one node. The other control planes join.
What restore plan sees Case What it proposes
Each member is healthy Nothing to do Nothing
One member is lost, the others have a majority One member lost EtcdRemoveMember, TalosReset of EPHEMERAL, WaitEtcdHealthy
No majority Majority lost A reset of each stuck member, then one EtcdRecover

Each proposed operation has metal.platform-kit.org/override-cluster-guard and metal.platform-kit.org/ignore-window, in the name of the person who runs the restore. The cluster is already down, so the guard and the windows must not hold the repair.

The operator, its records and its snapshots list go with the cluster that it runs on. Only the snapshots in the S3 sink stay. Restore from a bootstrap cluster, as for a new site:

  1. Start kind and install the operator, see Pivot.
  2. Write the TalosCluster again with the annotation os.platform-kit.org/restore-pending: "true".
  3. Decrypt the newest snapshot with pk-metal backup.
  4. Restore with talosctl, as the Talos documentation tells.
  5. Remove the annotation when Bootstrapped is True.

mise run lab:backup-restore takes a snapshot, wipes etcd and restores it.

Symptom Runbook
etcd has no leader or a member fails etcd unhealthy or quorum lost
The management cluster is gone Management cluster lost
Alert PkMetalEtcdBackupStale or PkMetalEtcdBackupMissing Backup failing
Alert PkMetalClusterUnavailable Cluster unavailable
Alert PkMetalMetricsAbsent Management cluster lost