Skip to content

Restore from a backup

You’ll restore specific namespaces from a completed Velero backup and confirm the restored state matches expectations.

Before restoring, identify the backup you want to restore from:

Terminal window
uds zarf tools kubectl get backup -n velero --sort-by=.status.startTimestamp

Only backups with a Completed phase can be used for a restore.

  1. Restore a namespace

    Create a restore for specific namespace(s) from a completed backup:

    Terminal window
    uds zarf tools kubectl apply -f - <<EOF
    apiVersion: velero.io/v1
    kind: Restore
    metadata:
    name: uds-restore-$(date +%s)
    namespace: velero
    spec:
    backupName: <backup-name>
    includedNamespaces:
    - <namespace>
    EOF

    Alternatively, if you have the Velero CLI installed:

    Terminal window
    velero restore create uds-restore-$(date +%s) \
    --from-backup <backup-name> \
    --include-namespaces <namespace> --wait
  2. Verify the restore

    Check the restore status:

    Terminal window
    uds zarf tools kubectl get restore -n velero

    Inspect the restored namespace to confirm resources are present:

    Terminal window
    uds zarf tools kubectl get pods -n <namespace>
    uds zarf tools kubectl get pvc -n <namespace>

To run a full end-to-end disaster recovery drill:

  1. Create a test namespace with a deployment and ConfigMap.
  2. Trigger a manual backup (see Perform a manual backup).
  3. Delete the test namespace.
  4. Restore from the backup (step 1 above).
  5. Verify the namespace, deployment, and ConfigMap are restored.

Success criteria:

  • Restore phase is Completed
  • All expected resources exist in the restored namespace
  • If volume snapshots were included, PVC data matches the pre-backup state

Problem: Restore completed but resources are missing

Section titled “Problem: Restore completed but resources are missing”

Symptoms: The restore phase shows Completed but expected resources are not present.

Solution: Verify the --include-namespaces scope matches the namespace you want to restore. Check that the backup actually captured the target namespace by inspecting the backup details:

Terminal window
uds zarf tools kubectl describe backup -n velero <backup-name>

Look at the Included Namespaces and Excluded Namespaces fields to confirm scope, and check Items Backed Up to verify the resource count. Also confirm the backup was taken after the resources were created.

Symptoms: PersistentVolumeClaims are recreated but contain no data.

Solution: Ensure the original PVC was deleted before running the restore. Verify that VolumeSnapshotContent resources exist for the backup:

Terminal window
uds zarf tools kubectl get volumesnapshotcontent

If VolumeSnapshotContents are missing, the backup may not have included volume snapshots. See Enable volume snapshots (AWS EBS) or Enable volume snapshots (vSphere CSI) to configure snapshot support.

These guides and concepts may be useful to explore next: