Skip to content

Cluster backups with Velero — manifests, PVs, and restore drills

Install Velero, back up namespaces and persistent volumes to object storage, schedule recurring backups, and test restores so the backups are actually useful.

Velero backs up Kubernetes objects to object storage and optionally captures PersistentVolume contents via CSI snapshots or restic-style file copies. The reason to run it isn’t “in case the cluster dies” — most cloud clusters survive the day fine — but for namespace-level mistakes, cluster migrations, and disaster-recovery drills you actually have to perform. This article gets Velero installed, scheduled, restored, and tested.

How to verify

The state of Velero and recent backups:

kubectl -n velero get pods
velero backup get
velero schedule get
velero backup-location get

The Velero Deployment should be Running. backup get lists every backup with status (Completed, Failed, PartiallyFailed). schedule get shows the recurring schedules with their cron expressions. backup-location get shows where backups live (S3 bucket, GCS bucket, etc.) and whether the location is reachable.

For one backup, the details surface everything needed for a restore decision:

velero backup describe nightly-2026-06-01 --details
velero backup logs nightly-2026-06-01 | head -50

What’s happening

Velero is a controller plus a CLI. The controller runs in velero namespace, listens for Backup/Restore/Schedule custom resources, and executes them. The CLI is a thin wrapper that creates those CRs. The data path uses object storage (S3-compatible) for the backup tarball — every API object, plus optional volume data.

Backups capture three things: objects (selected by namespace, label selector, or include/exclude lists), CSI VolumeSnapshots (if the cluster has CSI snapshotters configured), and (with the File System Backup plugin) literal file contents of pod volumes via restic/kopia. CSI snapshots are fast and cheap when the CSI driver supports them — preferred. File System Backup is the fallback for hostPath or in-tree volumes.

The backup location is a BucketStorageLocation pointing at an S3-compatible store; the volume snapshot location is a separate VolumeSnapshotLocation per provider. Both need credentials — usually a Secret mounted into the Velero Pod.

Restores are the inverse: pick a backup, restore objects into the same or a different namespace, optionally remapping. Cross-cluster restore (DR drill into a different cluster) works the same way — point the new cluster’s Velero at the same backup location and restore.

The procedure

  1. Install Velero with the AWS plugin (S3 + EBS), via the velero install CLI. Generate credentials and put them in a file credentials-velero:

    [default]
    aws_access_key_id = AKIA...
    aws_secret_access_key = wJalrX...
    velero install \
      --provider aws \
      --plugins velero/velero-plugin-for-aws:v1.9.0 \
      --bucket prod-velero-backups \
      --backup-location-config region=us-east-1 \
      --snapshot-location-config region=us-east-1 \
      --secret-file ./credentials-velero \
      --use-volume-snapshots=true \
      --features=EnableCSI
  2. Take a one-off backup of a namespace including PV data via CSI snapshots:

    velero backup create payments-2026-06-02 \
      --include-namespaces team-payments \
      --snapshot-volumes \
      --wait
    velero backup describe payments-2026-06-02 --details
  3. Schedule nightly backups of everything except kube-system and Velero itself:

    velero schedule create nightly \
      --schedule="0 2 * * *" \
      --exclude-namespaces kube-system,velero \
      --ttl 720h \
      --snapshot-volumes

    --ttl 720h keeps backups for 30 days; the controller deletes expired ones automatically.

  4. Add restic/kopia for non-CSI volumes if the cluster has hostPath or in-tree volumes. Install adds the node-agent DaemonSet:

    velero install \
      ... \
      --use-node-agent \
      --default-volumes-to-fs-backup

    On individual Pods that need it, annotate them with the volumes to back up:

    metadata:
      annotations:
        backup.velero.io/backup-volumes: "data,logs"
  5. Restore a backup into the same namespace (typical recovery from operator error):

    velero restore create payments-recover-1 \
      --from-backup nightly-2026-06-01 \
      --include-namespaces team-payments \
      --wait
    velero restore describe payments-recover-1
  6. Restore into a different namespace for testing or migration:

    velero restore create payments-test \
      --from-backup nightly-2026-06-01 \
      --namespace-mappings team-payments:team-payments-restore-test
  7. Run a quarterly DR drill. A real restore in a real environment — even into a sandbox cluster — catches expired credentials, missing CRDs, and gaps in the backup that paper review never finds:

    velero restore create dr-drill-$(date +%Y%m) \
      --from-backup nightly-2026-05-30 \
      --include-namespaces team-payments \
      --namespace-mappings team-payments:dr-test \
      --restore-volumes

Common pitfalls

  • A backup without --snapshot-volumes captures only the Kubernetes objects, not the PV contents — restoring it gives you empty PVCs.
  • CSI snapshot drivers must be installed and the StorageClass must reference them — kubectl get volumesnapshotclasses should not be empty. Without that, --snapshot-volumes silently produces no snapshots.
  • Restic/kopia file-system backup is much slower than CSI snapshots for large volumes — use CSI everywhere it’s available, restic only as fallback.
  • The Velero ServiceAccount needs IAM permissions on the bucket; an IAM role attached to a node group is fine for EKS, IRSA is better — without that, backups fail at upload time.
  • Restoring CRDs and the resources that depend on them in the same pass can race — velero restore orders by default, but custom controllers may need to reconcile in a specific order; use --restore-order or restore in two passes.

We operate Velero for clients with scheduled backups to a cross-account bucket, restic for legacy in-tree volumes, alerting on missed backups, and quarterly restore drills documented as runbooks. See /en/solutions/multi-region-environments/.