Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
velero backup create shop-$(date +%F) --include-namespaces shop --wait
velero backup describe shop-$(date +%F) --details
velero schedule create shop-daily --schedule="0 2 * * *" --include-namespaces shop --ttl 720h
velero restore create shop-test --from-backup shop-$(date +%F) --namespace-mappings shop:shop-restore-test --waitStep by step
- Install Velero with a bucket and the node agent for file-system volume backup (see the full guide). Check that the storage location is
Available:
velero backup-location get- First manual backup (quick answer, line 1) —
--waitwaits until it is done.Phase: Completedis good;PartiallyFailedneeds a look atvelero backup logs NAME. - Volume data — with
--default-volumes-to-fs-backupat install time, the node agent copies every volume's files. Or use CSI snapshots where your storage supports them. Checkdescribe --details: each volume must be listed under "Pod Volume Backups" or "CSI Snapshots". - Schedule (line 3) — every night at 02:00, kept for 30 days (
--ttl 720h). Add a separate weekly schedule with a longer TTL if needed. - Restore test into a new namespace (line 4) —
--namespace-mappingsrestoresshopasshop-restore-test, so production is not touched. Check the Pods start and the data is there, then delete the test namespace. - Real restore — delete or empty the broken namespace first; Velero does not overwrite existing objects by default (
--existing-resource-policy updatechanges that). - Before risky changes — a manual backup before a cluster upgrade or a big Helm change costs one minute.
- Protect the backups — the bucket in another account or region, versioning or object lock, and an alert when a backup fails (
velero_backup_failure_totalmetric, or checkvelero backup getdaily).
Check that it worked
velero backup get shows daily backups with STATUS Completed; the restore test shows Phase: Completed, and in shop-restore-test the app runs with the same data (for example the same row count in its database).
Common problems
| Problem | Cause | Fix |
|---|---|---|
Backup location Unavailable | Wrong bucket, region, endpoint or credentials. | velero backup-location get; check the secret and s3Url. |
PartiallyFailed | Some objects or volumes failed. | velero backup logs NAME | grep -i error. |
| Volume data missing after restore | Only objects were backed up. | Node agent with fs-backup, or CSI snapshots; check --details. |
| Restore skips objects | They already exist in the target. | Restore into a new namespace, or delete first; --existing-resource-policy update. |
Restored Pods stay Pending | StorageClass or node differs in the new cluster. | Map storage classes (Velero ConfigMap); check PVC events. |
| Backups fill the bucket | No TTL or old schedules. | --ttl; delete old schedules; bucket lifecycle as a second guard. |
Go further
- Command pages: kubectl, etcdctl.
- Next how-tos: Back up and restore etcd, Store files in MinIO with the S3 API, Back up and restore a Docker volume, Drain a node for maintenance.
- Learn it: CKA — etcd backup, CKS — Backup, Data services — backups. Full guide: Velero.
1What does Velero save that an etcd snapshot does not?
The data in persistent volumes, and backups per namespace that can be restored on their own or into another cluster.
2Why restore into a new namespace for a test?
It proves the backup works without touching the running production namespace.