Skip to content

Day 2

Back up etcd

Keep verified, encrypted etcd snapshots of a cluster away from its machines.

The operator takes a snapshot from a healthy etcd member, encrypts it to the age public keys, stores it in the sink and reads it back to verify it.etcd membera followerOperatorencrypt to age1...Sinks3 or pvcVerifiedEtcdSnapshotsnapshotwriteread back
Only a person with an age identity can decrypt a snapshot. The operator cannot.
  1. Each person who may restore makes an age key pair. Keep keys.txt like an SSH private key.

    Terminal window
    age-keygen -o ~/.config/age/keys.txt
  2. Show the public key. It starts with age1.

    Terminal window
    age-keygen -y ~/.config/age/keys.txt
  3. Put the S3 key into a Secret in pk-metal.

    Terminal window
    kubectl -n pk-metal create secret generic etcd-backup-s3 \
    --from-literal=accessKeyID=AKEXAMPLE --from-literal=secretAccessKey="$S3_SECRET"
  4. Write an EtcdBackupPolicy. Name at least two recipients.

    prod-offsite.yaml
    apiVersion: os.platform-kit.org/v1alpha1
    kind: EtcdBackupPolicy
    metadata:
    name: prod-offsite
    spec:
    clusterRef:
    name: prod
    interval: 6h
    retention:
    count: 28
    sink:
    s3:
    endpoint: https://s3.example.org
    bucket: etcd-backups
    prefix: metal/
    pathStyle: true
    credentialsSecretRef:
    name: etcd-backup-s3
    encryption:
    ageRecipients:
    - age1qexampleperson0000000000000000000000000000000000000000000
    - age1qexampleoffline000000000000000000000000000000000000000000
  5. Apply it as a member of the admin group.

    Terminal window
    kubectl apply -f prod-offsite.yaml
  6. Take the first snapshot now. The command waits until the operator verifies the snapshot.

    Terminal window
    pk-metal backup now prod-offsite
  7. Decrypt it on your workstation, as a test. Without -o, the command writes no plain file.

    Terminal window
    pk-metal backup decrypt prod-offsite-20261124-060000 --identity ~/.config/age/keys.txt
Terminal window
pk-metal backup list prod
kubectl get etcdbackuppolicy prod-offsite

The policy shows BackedUp=True and 0 failures.

What you see Go to
Ready=False, SinkRefused, SinkUnavailable or RecipientsInvalid Backup failing
BackedUp=False, BackupTooOld Backup failing