|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * backup_and_restore/application_backup_and_restore/oadp-use-cases/oadp-usecase-backup-using-odf.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="oadp-usecase-backup-odf_{context}"] |
| 7 | += Backing up an application using {oadp-short} and {odf-short} |
| 8 | + |
| 9 | +In this use case, you back up an application by using {oadp-short} and store the backup in an object storage provided by {odf-first}. |
| 10 | + |
| 11 | +* You create a object bucket claim (OBC) to configure the backup storage location. You use {odf-short} to configure an Amazon S3-compatible object storage bucket. {odf-short} provides MultiCloud Object Gateway (NooBaa MCG) and Ceph Object Gateway, also known as RADOS Gateway (RGW), object storage service. In this use case, you use NooBaa MCG as the backup storage location. |
| 12 | +* You use the NooBaa MCG service with {oadp-short} by using the `aws` provider plugin. |
| 13 | +* You configure the Data Protection Application (DPA) with the backup storage location (BSL). |
| 14 | +* You create a backup custom resource (CR) and specify the application namespace to back up. |
| 15 | +* You create and verify the backup. |
| 16 | +
|
| 17 | +.Prerequisites |
| 18 | + |
| 19 | +* You installed the {oadp-short} Operator. |
| 20 | +* You installed the {odf-short} Operator. |
| 21 | +* You have an application with a database running in a separate namespace. |
| 22 | +
|
| 23 | +.Procedure |
| 24 | + |
| 25 | +. Create an OBC manifest file to request a NooBaa MCG bucket as shown in the following example: |
| 26 | ++ |
| 27 | +.Example OBC |
| 28 | +[source,yaml] |
| 29 | +---- |
| 30 | +apiVersion: objectbucket.io/v1alpha1 |
| 31 | +kind: ObjectBucketClaim |
| 32 | +metadata: |
| 33 | + name: test-obc # <1> |
| 34 | + namespace: openshift-adp |
| 35 | +spec: |
| 36 | + storageClassName: openshift-storage.noobaa.io |
| 37 | + generateBucketName: test-backup-bucket # <2> |
| 38 | +---- |
| 39 | +<1> The name of the object bucket claim. |
| 40 | +<2> The name of the bucket. |
| 41 | + |
| 42 | +. Create the OBC by running the following command: |
| 43 | ++ |
| 44 | +[source,terminal] |
| 45 | +---- |
| 46 | +$ oc create -f <obc_file_name> # <1> |
| 47 | +---- |
| 48 | +<1> Specify the file name of the object bucket claim manifest. |
| 49 | + |
| 50 | +. When you create an OBC, {odf-short} creates a `secret` and a `config map` with the same name as the object bucket claim. The `secret` has the bucket credentials, and the `config map` has information to access the bucket. To get the bucket name and bucket host from the generated config map, run the following command: |
| 51 | ++ |
| 52 | +[source,terminal] |
| 53 | +---- |
| 54 | +$ oc extract --to=- cm/test-obc # <1> |
| 55 | +---- |
| 56 | +<1> `test-obc` is the name of the OBC. |
| 57 | ++ |
| 58 | +.Example output |
| 59 | +[source,terminal] |
| 60 | +---- |
| 61 | +# BUCKET_NAME |
| 62 | +backup-c20...41fd |
| 63 | +# BUCKET_PORT |
| 64 | +443 |
| 65 | +# BUCKET_REGION |
| 66 | + |
| 67 | +# BUCKET_SUBREGION |
| 68 | + |
| 69 | +# BUCKET_HOST |
| 70 | +s3.openshift-storage.svc |
| 71 | +---- |
| 72 | + |
| 73 | +. To get the bucket credentials from the generated `secret`, run the following command: |
| 74 | ++ |
| 75 | +[source,terminal] |
| 76 | +---- |
| 77 | +$ oc extract --to=- secret/test-obc |
| 78 | +---- |
| 79 | ++ |
| 80 | +.Example output |
| 81 | +[source,terminal] |
| 82 | +---- |
| 83 | +# AWS_ACCESS_KEY_ID |
| 84 | +ebYR....xLNMc |
| 85 | +# AWS_SECRET_ACCESS_KEY |
| 86 | +YXf...+NaCkdyC3QPym |
| 87 | +---- |
| 88 | + |
| 89 | +. Get the public URL for the S3 endpoint from the s3 route in the `openshift-storage` namespace by running the following command: |
| 90 | ++ |
| 91 | +[source,terminal] |
| 92 | +---- |
| 93 | +$ oc get route s3 -n openshift-storage |
| 94 | +---- |
| 95 | + |
| 96 | +. Create a `cloud-credentials` file with the object bucket credentials as shown in the following command: |
| 97 | ++ |
| 98 | +[source,terminal] |
| 99 | +---- |
| 100 | +[default] |
| 101 | +aws_access_key_id=<AWS_ACCESS_KEY_ID> |
| 102 | +aws_secret_access_key=<AWS_SECRET_ACCESS_KEY> |
| 103 | +---- |
| 104 | + |
| 105 | +. Create the `cloud-credentials` secret with the `cloud-credentials` file content as shown in the following command: |
| 106 | ++ |
| 107 | +[source,terminal] |
| 108 | +---- |
| 109 | +$ oc create secret generic \ |
| 110 | + cloud-credentials \ |
| 111 | + -n openshift-adp \ |
| 112 | + --from-file cloud=cloud-credentials |
| 113 | +---- |
| 114 | + |
| 115 | +. Configure the Data Protection Application (DPA) as shown in the following example: |
| 116 | ++ |
| 117 | +.Example DPA |
| 118 | +[source,yaml] |
| 119 | +---- |
| 120 | +apiVersion: oadp.openshift.io/v1alpha1 |
| 121 | +kind: DataProtectionApplication |
| 122 | +metadata: |
| 123 | + name: oadp-backup |
| 124 | + namespace: openshift-adp |
| 125 | +spec: |
| 126 | + configuration: |
| 127 | + nodeAgent: |
| 128 | + enable: true |
| 129 | + uploaderType: kopia |
| 130 | + velero: |
| 131 | + defaultPlugins: |
| 132 | + - aws |
| 133 | + - openshift |
| 134 | + - csi |
| 135 | + defaultSnapshotMoveData: true # <1> |
| 136 | + backupLocations: |
| 137 | + - velero: |
| 138 | + config: |
| 139 | + profile: "default" |
| 140 | + region: noobaa |
| 141 | + s3Url: https://s3.openshift-storage.svc # <2> |
| 142 | + s3ForcePathStyle: "true" |
| 143 | + insecureSkipTLSVerify: "true" |
| 144 | + provider: aws |
| 145 | + default: true |
| 146 | + credential: |
| 147 | + key: cloud |
| 148 | + name: cloud-credentials |
| 149 | + objectStorage: |
| 150 | + bucket: <bucket_name> # <3> |
| 151 | + prefix: oadp |
| 152 | +---- |
| 153 | +<1> Set to true to use the {oadp-short} Data Mover to enable movement of Container Storage Interface (CSI) snapshots to a remote object storage. |
| 154 | +<2> This is the S3 URL of {odf-short} storage. |
| 155 | +<3> Specify the bucket name. |
| 156 | + |
| 157 | +. Create the DPA by running the following command: |
| 158 | ++ |
| 159 | +[source,terminal] |
| 160 | +---- |
| 161 | +$ oc apply -f <dpa_filename> |
| 162 | +---- |
| 163 | + |
| 164 | +. Verify that the DPA is created successfully by running the following command. In the example output, you can see the `status` object has `type` field set to `Reconciled`. This means, the DPA is successfully created. |
| 165 | ++ |
| 166 | +[source,terminal] |
| 167 | +---- |
| 168 | +$ oc get dpa -o yaml |
| 169 | +---- |
| 170 | ++ |
| 171 | +.Example output |
| 172 | ++ |
| 173 | +[source,yaml] |
| 174 | +---- |
| 175 | +apiVersion: v1 |
| 176 | +items: |
| 177 | +- apiVersion: oadp.openshift.io/v1alpha1 |
| 178 | + kind: DataProtectionApplication |
| 179 | + metadata: |
| 180 | + namespace: openshift-adp |
| 181 | + #...# |
| 182 | + spec: |
| 183 | + backupLocations: |
| 184 | + - velero: |
| 185 | + config: |
| 186 | + #...# |
| 187 | + status: |
| 188 | + conditions: |
| 189 | + - lastTransitionTime: "20....9:54:02Z" |
| 190 | + message: Reconcile complete |
| 191 | + reason: Complete |
| 192 | + status: "True" |
| 193 | + type: Reconciled |
| 194 | +kind: List |
| 195 | +metadata: |
| 196 | + resourceVersion: "" |
| 197 | +---- |
| 198 | + |
| 199 | +. Verify that the backup storage location (BSL) is available by running the following command: |
| 200 | ++ |
| 201 | +[source,terminal] |
| 202 | +---- |
| 203 | +$ oc get bsl -n openshift-adp |
| 204 | +---- |
| 205 | ++ |
| 206 | +.Example output |
| 207 | +[source,terminal] |
| 208 | +---- |
| 209 | +NAME PHASE LAST VALIDATED AGE DEFAULT |
| 210 | +dpa-sample-1 Available 3s 15s true |
| 211 | +---- |
| 212 | + |
| 213 | +. Configure a backup CR as shown in the following example: |
| 214 | ++ |
| 215 | +.Example backup CR |
| 216 | +[source,yaml] |
| 217 | +---- |
| 218 | +apiVersion: velero.io/v1 |
| 219 | +kind: Backup |
| 220 | +metadata: |
| 221 | + name: test-backup |
| 222 | + namespace: openshift-adp |
| 223 | +spec: |
| 224 | + includedNamespaces: |
| 225 | + - <application_namespace> # <1> |
| 226 | +---- |
| 227 | +<1> Specify the namespace for the application to back up. |
| 228 | + |
| 229 | +. Create the backup CR by running the following command: |
| 230 | ++ |
| 231 | +[source,terminal] |
| 232 | +---- |
| 233 | +$ oc apply -f <backup_cr_filename> |
| 234 | +---- |
| 235 | + |
| 236 | +.Verification |
| 237 | + |
| 238 | +* Verify that the backup object is in the `Completed` phase by running the following command. For more details, see the example output. |
| 239 | ++ |
| 240 | +[source,terminal] |
| 241 | +---- |
| 242 | +$ oc describe backup test-backup -n openshift-adp |
| 243 | +---- |
| 244 | ++ |
| 245 | +.Example output |
| 246 | +[source,terminal] |
| 247 | +---- |
| 248 | +Name: test-backup |
| 249 | +Namespace: openshift-adp |
| 250 | +# ....# |
| 251 | +Status: |
| 252 | + Backup Item Operations Attempted: 1 |
| 253 | + Backup Item Operations Completed: 1 |
| 254 | + Completion Timestamp: 2024-09-25T10:17:01Z |
| 255 | + Expiration: 2024-10-25T10:16:31Z |
| 256 | + Format Version: 1.1.0 |
| 257 | + Hook Status: |
| 258 | + Phase: Completed |
| 259 | + Progress: |
| 260 | + Items Backed Up: 34 |
| 261 | + Total Items: 34 |
| 262 | + Start Timestamp: 2024-09-25T10:16:31Z |
| 263 | + Version: 1 |
| 264 | +Events: <none> |
| 265 | +---- |
0 commit comments