This is a cache of https://docs.okd.io/4.17/backup_and_restore/application_backup_and_restore/backing_up_and_restoring/oadp-creating-backup-cr.html. It is a snapshot of the page at 2026-05-20T01:58:10.826+0000.
Creating a Backup CR - OADP Application backup and restore | Backup and restore | OKD 4.17
×

Back up Kubernetes resources, internal images, and persistent volumes (PVs) by creating a Backup custom resource (CR). This helps you to protect your application data and configuration for disaster recovery.

Prerequisites
  • You must install the OpenShift api for Data Protection (OADP) Operator.

  • The DataProtectionApplication CR must be in a Ready state.

  • Backup location prerequisites:

    • You must have S3 object storage configured for Velero.

    • You must have a backup location configured in the DataProtectionApplication CR.

  • Snapshot location prerequisites:

    • Your cloud provider must have a native snapshot api or support Container Storage Interface (CSI) snapshots.

    • For CSI snapshots, you must create a VolumeSnapshotClass CR to register the CSI driver.

    • You must have a volume location configured in the DataProtectionApplication CR.

Procedure
  1. Retrieve the backupStorageLocations CRs by entering the following command:

    $ oc get backupstoragelocations.velero.io -n openshift-adp
    NAMESPACE       NAME              PHASE       LAST VALIDATED   AGE   DEFAULT
    openshift-adp   velero-sample-1   Available   11s              31m
  2. Create a Backup CR, as in the following example:

    apiVersion: velero.io/v1
    kind: Backup
    metadata:
      name: <backup>
      labels:
        velero.io/storage-location: default
      namespace: openshift-adp
    spec:
      hooks: {}
      includedNamespaces:
      - <namespace>
      includedResources: []
      excludedResources: []
      storageLocation: <velero-sample-1>
      ttl: 720h0m0s
      labelSelector:
        matchLabels:
          app: <label_1>
          app: <label_2>
          app: <label_3>
      orLabelSelectors:
      - matchLabels:
          app: <label_1>
          app: <label_2>
          app: <label_3>

    where:

    <namespace>

    Specifies an array of namespaces to back up.

    includedResources

    Optional: Specifies an array of resources to include in the backup. Resources might be shortcuts (for example, po for pods) or fully-qualified. If unspecified, all resources are included.

    excludedResources

    Optional: Specifies an array of resources to exclude from the backup. Resources might be shortcuts (for example, po for pods) or fully-qualified.

    <velero-sample-1>

    Specifies the name of the backupStorageLocations CR.

    labelSelector

    Specifies a map of {key,value} pairs of backup resources that have all the specified labels.

    orLabelSelectors

    Specifies a map of {key,value} pairs of backup resources that have one or more of the specified labels.

  3. Verify that the status of the Backup CR is Completed:

    $ oc get backups.velero.io -n openshift-adp <backup> -o jsonpath='{.status.phase}'