Velero
Velero backs up a whole namespace in one Backup, with the PVC data moved to S3. bret restores
only the PVCs of that Backup into a scratch namespace and runs the check against them. Your app
and its namespace are never touched.
How it works
Section titled “How it works”- bret reads the
Backupin the Velero namespace. It refuses aBackupwhose volume data a PVC-only restore cannot bring back (see Volume data). - It creates a Velero
RestorewithincludedResources: [persistentvolumeclaims, persistentvolumes],includedNamespacesset to theRestorenamespace, and anamespaceMappingtobret-scratch-<hash>. No Deployment, Service or Secret of the backup is restored. - When the Velero
RestoreisCompleted, bret copies the pod-security labels of your namespace and the Secrets and ConfigMaps the check names into the scratch namespace. - It runs the check pod there, with each restored PVC mounted under its source name.
- On cleanup the operator deletes the Velero
Restoreand the scratch namespace.
<hash> is the first 12 hex characters of sha256("<namespace>/<name>") of the Restore.
Velero labels and annotations bret reads
Section titled “Velero labels and annotations bret reads”| Key | On | What bret uses it for |
|---|---|---|
velero.io/backup-name |
PodVolumeBackup |
Finds the file system backups of the Backup it is about to restore. |
velero.io/pvc-name |
PodVolumeBackup (annotation) |
Tells whether a source PVC was saved as file system backup. Such a PVC fails with BackupUnsupported. |
velero.io/schedule-name |
Backup |
Not read by bret itself. Velero sets it on every Backup of a Schedule, so it is the usual label for backupSelector.labels. |
bret also reads these Backup fields: status.phase, status.completionTimestamp,
spec.includedNamespaces, spec.excludedNamespaces and spec.snapshotVolumes.
Next steps
Section titled “Next steps”- Add bret to an existing Velero setup: the checklist.
- Walkthrough: a WordPress + MariaDB example from install to
RestoreTest. - Limitations: what bret cannot do with Velero, and fixes.
Install Velero
Section titled “Install Velero”Skip this if Velero already runs. Tested with Velero 1.18.2 (Helm chart 12.2.5) and the AWS plugin v1.14.4 on kind with Kubernetes 1.37:
velero install \ --provider aws \ --plugins velero/velero-plugin-for-aws:v1.14.4 \ --bucket velero \ --secret-file ./velero-credentials \ --backup-location-config "region=us-east-1,s3ForcePathStyle=true,s3Url=https://s3.example.internal" \ --use-node-agent \ --use-volume-snapshots=false \ --features=EnableCSI \ --waitvelero-credentials is an AWS-style credentials file. Do not commit it:
[default]aws_access_key_id = <access key>aws_secret_access_key = <secret key>The node agent (--use-node-agent) moves CSI snapshot data to S3. bret needs that for
snapshotMoveData.
