|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * backup_and_restore/application_backup_and_restore/backing_up_and_restoring/backing-up-applications.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="oadp-using-data-mover-for-csi-snapshots_{context}"] |
| 7 | += Using Data Mover for CSI snapshots |
| 8 | + |
| 9 | +:FeatureName: Data Mover for CSI snapshots |
| 10 | +include::snippets/technology-preview.adoc[] |
| 11 | + |
| 12 | +The OADP 1.1.0 Data Mover enables customers to back up container storage interface (CSI) volume snapshots to a remote object store. When Data Mover is enabled, you can restore stateful applications from the store if a failure, accidental deletion, or corruption of the cluster occurs. The OADP 1.1.0 Data Mover solution uses the Restic option of VolSync. |
| 13 | + |
| 14 | +[NOTE] |
| 15 | +===== |
| 16 | +Data Mover supports backup and restore of CSI volume snapshots only. |
| 17 | +
|
| 18 | +Currently, Data Mover does not support Google Cloud Storage (GCS) buckets. |
| 19 | +===== |
| 20 | + |
| 21 | +.Prerequisites |
| 22 | + |
| 23 | +* You have verified that the `StorageClass` and `VolumeSnapshotClass` custom resources (CRs) support CSI. |
| 24 | +
|
| 25 | +* You have verified that only one `volumeSnapshotClass` CR has the annotation `snapshot.storage.kubernetes.io/is-default-class: true`. |
| 26 | +
|
| 27 | +* You have verified that only one `storageClass` CR has the annotation `storageclass.kubernetes.io/is-default-class: true`. |
| 28 | +
|
| 29 | +* You have included the label `{velero-domain}/csi-volumesnapshot-class: 'true'` in your `VolumeSnapshotClass` CR. |
| 30 | +
|
| 31 | +* You have installed the VolSync Operator by using the Operator Lifecycle Manager (OLM). |
| 32 | ++ |
| 33 | +[NOTE] |
| 34 | +==== |
| 35 | +The VolSync Operator is required only for use with the Technology Preview Data Mover. The Operator is not required for using OADP production features. |
| 36 | +==== |
| 37 | +
|
| 38 | +* You have installed the OADP operator by using OLM. |
| 39 | +
|
| 40 | +.Procedure |
| 41 | + |
| 42 | +. Configure a Restic secret by creating a `.yaml` file as following: |
| 43 | ++ |
| 44 | +[source,yaml] |
| 45 | +---- |
| 46 | +apiVersion: v1 |
| 47 | +kind: Secret |
| 48 | +metadata: |
| 49 | + name: <secret_name> |
| 50 | + namespace: openshift-adp |
| 51 | +type: Opaque |
| 52 | +stringData: |
| 53 | + RESTIC_PASSWORD: <secure_restic_password> |
| 54 | +---- |
| 55 | ++ |
| 56 | +[NOTE] |
| 57 | +==== |
| 58 | +By default, the Operator looks for a secret named `dm-credential`. If you are using a different name, you need to specify the name through a Data Protection Application (DPA) CR using `dpa.spec.features.dataMover.credentialName`. |
| 59 | +==== |
| 60 | + |
| 61 | +. Create a DPA CR similar to the following example. The default plug-ins include CSI. |
| 62 | ++ |
| 63 | +.Example Data Protection Application (DPA) CR |
| 64 | +[source,yaml] |
| 65 | +---- |
| 66 | +apiVersion: oadp.openshift.io/v1alpha1 |
| 67 | +kind: DataProtectionApplication |
| 68 | +metadata: |
| 69 | + name: velero-sample |
| 70 | + namespace: openshift-adp |
| 71 | +spec: |
| 72 | + features: |
| 73 | + dataMover: |
| 74 | + enable: true |
| 75 | + credentialName: <secret_name> <1> |
| 76 | + backupLocations: |
| 77 | + - velero: |
| 78 | + config: |
| 79 | + profile: default |
| 80 | + region: us-east-1 |
| 81 | + credential: |
| 82 | + key: cloud |
| 83 | + name: cloud-credentials |
| 84 | + default: true |
| 85 | + objectStorage: |
| 86 | + bucket: <bucket_name> |
| 87 | + prefix: <bucket_prefix> |
| 88 | + provider: aws |
| 89 | + configuration: |
| 90 | + restic: |
| 91 | + enable: <true_or_false> |
| 92 | + velero: |
| 93 | + defaultPlugins: |
| 94 | + - openshift |
| 95 | + - aws |
| 96 | + - csi |
| 97 | +---- |
| 98 | +<1> Add the Restic secret name from the previous step. If this is not done, the default secret name `dm-credential` is used. |
| 99 | ++ |
| 100 | +The OADP Operator installs two custom resource definitions (CRDs), `VolumeSnapshotBackup` and `VolumeSnapshotRestore`. |
| 101 | ++ |
| 102 | +.Example `VolumeSnapshotBackup` CRD |
| 103 | +[source,yaml] |
| 104 | +---- |
| 105 | +apiVersion: datamover.oadp.openshift.io/v1alpha1 |
| 106 | +kind: VolumeSnapshotBackup |
| 107 | +metadata: |
| 108 | + name: <vsb_name> |
| 109 | + namespace: <namespace_name> <1> |
| 110 | +spec: |
| 111 | + volumeSnapshotContent: |
| 112 | + name: <snapcontent_name> |
| 113 | + protectedNamespace: <adp_namespace> |
| 114 | + resticSecretRef: |
| 115 | + name: <restic_secret_name> |
| 116 | +---- |
| 117 | +<1> Specify the namespace where the volume snapshot exists. |
| 118 | ++ |
| 119 | +.Example `VolumeSnapshotRestore` CRD |
| 120 | +[source,yaml] |
| 121 | +---- |
| 122 | +apiVersion: datamover.oadp.openshift.io/v1alpha1 |
| 123 | +kind: VolumeSnapshotRestore |
| 124 | +metadata: |
| 125 | + name: <vsr_name> |
| 126 | + namespace: <namespace_name> <1> |
| 127 | +spec: |
| 128 | + protectedNamespace: <protected_ns> <2> |
| 129 | + resticSecretRef: |
| 130 | + name: <restic_secret_name> |
| 131 | + volumeSnapshotMoverBackupRef: |
| 132 | + sourcePVCData: |
| 133 | + name: <source_pvc_name> |
| 134 | + size: <source_pvc_size> |
| 135 | + resticrepository: <your_restic_repo> |
| 136 | + volumeSnapshotClassName: <vsclass_name> |
| 137 | +---- |
| 138 | +<1> Specify the namespace where the volume snapshot exists. |
| 139 | +<2> Specify the namespace where the Operator is installed. The default is `openshift-adp`. |
| 140 | + |
| 141 | +. You can back up a volume snapshot by performing the following steps: |
| 142 | + |
| 143 | +.. Create a backup CR: |
| 144 | ++ |
| 145 | +[source,yaml] |
| 146 | +---- |
| 147 | +apiVersion: {velero-domain}/v1 |
| 148 | +kind: Backup |
| 149 | +metadata: |
| 150 | + name: <backup_name> |
| 151 | + namespace: <protected_ns> <1> |
| 152 | +spec: |
| 153 | + includedNamespaces: |
| 154 | + - <app_ns> |
| 155 | + storageLocation: velero-sample-1 |
| 156 | +---- |
| 157 | +<1> Specify the namespace where the Operator is installed. The default namespace is `openshift-adp`. |
| 158 | + |
| 159 | +.. Wait up to 10 minutes and check whether the `VolumeSnapshotBackup` CR status is `Completed` by entering the following commands: |
| 160 | ++ |
| 161 | +[source,terminal] |
| 162 | +---- |
| 163 | +$ oc get vsb -n <app_ns> |
| 164 | +---- |
| 165 | ++ |
| 166 | +[source,terminal] |
| 167 | +---- |
| 168 | +$ oc get vsb <vsb_name> -n <app_ns> -o jsonpath="{.status.phase}" |
| 169 | +---- |
| 170 | ++ |
| 171 | +A snapshot is created in the object store was configured in the DPA. |
| 172 | ++ |
| 173 | +[NOTE] |
| 174 | +==== |
| 175 | +If the status of the `VolumeSnapshotBackup` CR becomes `Failed`, refer to the Velero logs for troubleshooting. |
| 176 | +==== |
| 177 | + |
| 178 | +. You can restore a volume snapshot by performing the following steps: |
| 179 | + |
| 180 | +.. Delete the application namespace and the `volumeSnapshotContent` that was created by the Velero CSI plug-in. |
| 181 | + |
| 182 | +.. Create a `Restore` CR and set `restorePVs` to `true`. |
| 183 | ++ |
| 184 | +.Example `Restore` CR |
| 185 | +[source,yaml] |
| 186 | +---- |
| 187 | +apiVersion: velero.io/v1 |
| 188 | +kind: Restore |
| 189 | +metadata: |
| 190 | + name: <restore_name> |
| 191 | + namespace: <protected_ns> |
| 192 | +spec: |
| 193 | + backupName: <previous_backup_name> |
| 194 | + restorePVs: true |
| 195 | +---- |
| 196 | + |
| 197 | +.. Wait up to 10 minutes and check whether the `VolumeSnapshotRestore` CR status is `Completed` by entering the following command: |
| 198 | ++ |
| 199 | +[source,terminal] |
| 200 | +---- |
| 201 | +$ oc get vsr -n <app_ns> |
| 202 | +---- |
| 203 | ++ |
| 204 | +[source,terminal] |
| 205 | +---- |
| 206 | +$ oc get vsr <vsr_name> -n <app_ns> -o jsonpath="{.status.phase}" |
| 207 | +---- |
| 208 | + |
| 209 | +.. Check whether your application data and resources have been restored. |
| 210 | ++ |
| 211 | +[NOTE] |
| 212 | +==== |
| 213 | +If the status of the `VolumeSnapshotRestore` CR becomes 'Failed', refer to the Velero logs for troubleshooting. |
| 214 | +==== |
0 commit comments