CodeBlanks Logo Icon CodeBlanks

Backup strategy

Learn cluster backup strategies.

Backup strategy

To recover a cluster from disaster you need to know what is backed up. There are three layers:

  • Cluster state: all Kubernetes objects; it lives in etcd.
  • Persistent data: the database and files on PersistentVolumes; it is not in etcd.
  • Definitions: the manifests, charts and values files in Git (already versioned with GitOps).

The 3-2-1 rule: 3 copies of the data, on 2 different media, 1 of them elsewhere (another region or account).

etcd snapshot     -> s3://yedek-eu/etcd/      (every hour)
Velero backup     -> s3://yedek-tr/velero/    (every night, keep 30 days)
Git repository    -> GitHub + mirror          (every commit)

Testing the backup

A backup that has never been restored doesn't count as a backup. A restore drill to an empty cluster is done regularly and the duration is measured. Encryption and retention of backups are also tied to policy:

# every month: drill
1. set up the staging-dr cluster
2. restore the latest Velero backup
3. run the application tests
4. record the duration (target: under 1 hour)

Practice List the backups

Write three commands: list the files under s3://yedek-eu/etcd/ (aws s3 ls); list the PersistentVolumeClaims in the cluster across all namespaces (-A); list the Velero backups (velero backup get).

Starter code

terminal
# buraya yaz

Sample solution

terminal
aws s3 ls s3://yedek-eu/etcd/
kubectl get pvc -A
velero backup get

Expected output

2026-11-03 09:00:12   48234112 etcd-2026-11-03-0900.db
2026-11-03 10:00:09   48301660 etcd-2026-11-03-1000.db
NAMESPACE   NAME        STATUS   VOLUME     CAPACITY   ACCESS MODES
magaza      veri-db-0   Bound    pvc-7a1c   20Gi       RWO
NAME           STATUS      CREATED                         EXPIRES
gece-2026-11   Completed   2026-11-03 02:00:00 +0300 +03   29d

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 In a cluster where only etcd is backed up, what is lost?

  • Deployment definitions
  • ConfigMaps
  • Secrets
  • The database data on PersistentVolumes Correct answer

Explanation: etcd holds the objects; data on disks must be backed up separately.

2 The number of copies kept elsewhere in the 3-2-1 rule.

Question
3 copies, 2 media, ____ of them in another region
Answer
3 copies, 2 media, 1 of them in another region

Explanation: One copy must be where the disaster can't reach.

3 Match.

Term Meaning
etcd Cluster objects
PersistentVolume Application data
Git Definitions
tatbikat Restore trial

All lessons in Expert