Skip to content

Day 2

Restore etcd

Bring back the etcd of a cluster with the minimum data loss.

Terminal window
pk-metal restore plan prod

The command asks each control plane about its etcd. It changes nothing.

What the plan sees Case
Each member healthy Nothing to do
One member stopped or has errors; the others keep a majority One member lost
No control plane lists members, or most do not answer Majority lost
The operator's own cluster has no etcd Management cluster lost

No snapshot is necessary. The broken member leaves, its data is wiped, and it joins again.

  1. Propose the repair.

    Terminal window
    pk-metal restore plan prod --propose

    The command makes prod-etcd-replace-<node> with EtcdRemoveMember, TalosReset and WaitEtcdHealthy.

  2. Approve it. If your site forbids self-approval, ask a second person to approve it.

    Terminal window
    pk-metal approve pk-metal/prod-etcd-replace-cp-2
  3. Monitor it until it is Succeeded.

    Terminal window
    kubectl -n pk-metal get hostoperation prod-etcd-replace-cp-2 -w

Repair one member at a time. With three control planes, a second lost member is a lost majority.

Restore from a snapshot

1 / 5

A restore resets the stuck members and uploads the snapshot to one control plane. etcd starts there and the others join.EtcdSnapshotVerifiedYour workstationage identitycp-1no quorumcp-2no quorumcp-3no quorumuploadjoindownload

Plan

The plan picks the newest verified snapshot and one control plane. It shows when the snapshot was taken.

pk-metal restore plan prod --propose
  1. Plan. The plan picks the newest verified snapshot and one control plane. It shows when the snapshot was taken.

    pk-metal restore plan prod --propose
  2. Reset. An approved reset wipes the etcd data on each control plane that runs a stuck etcd.

    prod-etcd-reset-cp-2, prod-etcd-reset-cp-3
  3. Upload. After the approval, you decrypt the snapshot on your workstation and stream it to cp-1. The plain data never touches a disk.

    pk-metal restore upload pk-metal/prod-etcd-recover-cp-1 --identity ~/.config/age/keys.txt
  4. Recover. etcdRecover starts etcd on cp-1 from the snapshot, one time.

  5. Join. The other control planes join the restored member. Bootstrapped is True again.

  1. List the snapshots.

    Terminal window
    pk-metal backup list prod
  2. Propose the plan. Name the snapshot and the control plane, or take the defaults.

    Terminal window
    pk-metal restore plan prod --snapshot prod-offsite-20261124-060000 --node cp-1 --propose
  3. Approve each reset operation, or ask a second person if your site forbids self-approval.

    Terminal window
    pk-metal approve pk-metal/prod-etcd-reset-cp-2
  4. Approve the recover operation, or ask a second person if your site forbids self-approval.

    Terminal window
    pk-metal approve pk-metal/prod-etcd-recover-cp-1
  5. Upload the snapshot. For a pvc sink, copy the snapshot first. Then add --from-file <file.age>.

    Terminal window
    pk-metal restore upload pk-metal/prod-etcd-recover-cp-1 --identity ~/.config/age/keys.txt
  6. Monitor the operations.

    Terminal window
    kubectl -n pk-metal get hostoperation -l os.platform-kit.org/etcd-restore=prod

The manager image has no shell. Use a small pod that mounts the backup volume. The pod runs as the user of the manager, which owns the files. It meets the restricted Pod Security level of the namespace.

  1. Find the node of the manager. A volume that attaches to one node only needs the pod on that node.

    Terminal window
    node=$(kubectl -n pk-metal get pod -l app.kubernetes.io/name=pk-metal,app.kubernetes.io/component=manager \
    -o jsonpath='{.items[0].spec.nodeName}')
  2. Start the reader pod on that node.

    Terminal window
    kubectl apply -f - <<YAML
    apiVersion: v1
    kind: Pod
    metadata:
    name: etcd-backup-reader
    namespace: pk-metal
    spec:
    nodeName: $node
    restartPolicy: Never
    securityContext:
    runAsNonRoot: true
    runAsUser: 65532
    runAsGroup: 65532
    seccompProfile: { type: RuntimeDefault }
    containers:
    - name: reader
    image: busybox:1.37
    command: ["sleep", "3600"]
    securityContext:
    allowPrivilegeEscalation: false
    capabilities: { drop: ["ALL"] }
    volumeMounts:
    - { name: backups, mountPath: /backups, readOnly: true }
    volumes:
    - name: backups
    persistentVolumeClaim: { claimName: pk-metal-etcd-backups, readOnly: true }
    YAML
    kubectl -n pk-metal wait --for=condition=Ready pod/etcd-backup-reader
  3. Copy the snapshot. Its path is <cluster>/<snapshot>.db.age, as status.key of the EtcdSnapshot shows.

    Terminal window
    kubectl -n pk-metal exec etcd-backup-reader -- ls -l /backups/prod
    kubectl -n pk-metal exec etcd-backup-reader -- cat /backups/prod/prod-daily-20261124-060000.db.age > prod.db.age
  4. Delete the pod.

    Terminal window
    kubectl -n pk-metal delete pod etcd-backup-reader

Give the file to pk-metal restore upload --from-file, or decrypt it with pk-metal backup decrypt --in prod.db.age.

  • kubectl get taloscluster prod shows Bootstrapped=True and Available=True.
  • pk-metal restore plan prod reports that each member is healthy.
What you see Go to
etcdRecover waits for a control plane that never answers Remove its TalosNode, or replace the machine. Then plan again.
restore upload stops on a hash mismatch The file is not the approved snapshot. Use the approved one.
Bootstrapped=False with another reason Bootstrap refused