×

You back up persistent volumes with Container Storage Interface (CSI) snapshots by editing the VolumeSnapshotClass custom resource (CR) of the cloud storage before you create the Backup CR, see CSI volume snapshots.

For more information, see Creating a Backup CR.

Prerequisites
  • The cloud provider must support CSI snapshots.

  • You must enable CSI in the DataProtectionApplication CR.

Procedure
  • Add the metadata.labels.velero.io/csi-volumesnapshot-class: "true" key-value pair to the VolumeSnapshotClass CR:

    Example configuration file
    apiVersion: snapshot.storage.k8s.io/v1
    kind: VolumeSnapshotClass
    metadata:
      name: <volume_snapshot_class_name>
      labels:
        velero.io/csi-volumesnapshot-class: "true" (1)
      annotations:
        snapshot.storage.kubernetes.io/is-default-class: true (2)
    driver: <csi_driver>
    deletionPolicy: <deletion_policy_type> (3)
    1 Must be set to true.
    2 If you are restoring this volume in another cluster with the same driver, make sure that you set the snapshot.storage.kubernetes.io/is-default-class parameter to false instead of setting it to true. Otherwise, the restore will partially fail.
    3 OADP supports the Retain and Delete deletion policy types for CSI and Data Mover backup and restore.
Next steps
  • You can now create a Backup CR.