You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -14,15 +14,35 @@ The OpenShift API for Data Protection (OADP) is designed to protect Application
14
14
15
15
Red Hat® OpenShift® Data Foundation is software-defined storage for containers. Engineered as the data and storage services platform for Red Hat OpenShift, Red Hat OpenShift Data Foundation helps teams develop and deploy applications quickly and efficiently across clouds.
16
16
17
-
In this guide, we will cover:
18
-
- Operators installation
17
+
## Table of Content
18
+
-[Guide: Backup and Restore Stateful Applications on OpenShift using OADP and ODF](#guide-backup-and-restore-stateful-applications-on-openshift-using-oadp-and-odf)
19
+
-[Table of Content](#table-of-content)
20
+
-[Pre-requisites](#pre-requisites)
21
+
-[Installing OpenShift Data Foundation Operator](#installing-openshift-data-foundation-operator)
-[Gathering information from Object Bucket](#gathering-information-from-object-bucket)
25
+
-[Deploying an application](#deploying-an-application)
26
+
-[Installing OpenShift API for Data Protection Operator](#installing-openshift-api-for-data-protection-operator)
27
+
-[Create credentials secret for OADP Operator to use](#create-credentials-secret-for-oadp-operator-to-use)
28
+
-[Back up application](#back-up-application)
29
+
-[Uhh what? Disasters?](#uhh-what-disasters)
30
+
-[Restore application](#restore-application)
31
+
-[Conclusion](#conclusion)
32
+
-[Remove workloads from this guide](#remove-workloads-from-this-guide)
33
+
34
+
35
+
<!-- In this guide, we will cover:
36
+
- Operators installation -->
19
37
<!-- - Local Storage Operator -->
20
-
- OpenShift Data Foundation
38
+
<!--- OpenShift Data Foundation
21
39
- OpenShift API for Data Protection Operator
22
40
- Application deployment
23
41
- Application protection
24
42
- A disaster scenario
25
-
- Application recovery from disaster
43
+
- Application recovery from disaster -->
44
+
45
+
The term *Project* and *namespace* maybe used interchangeably in this guide.
26
46
## Pre-requisites
27
47
- Terminal environment
28
48
- Your terminal has the following commands
@@ -46,7 +66,7 @@ We will be using OpenShift Data Foundation to simplify application deployment ac
46
66
47
67
1. Open the OpenShift Web Console by navigating to the url below, make sure you are in Administrator view, not Developer.
48
68
49
-
```
69
+
```sh
50
70
oc get route console -n openshift-console -ojsonpath="{.spec.host}"
51
71
```
52
72
Authenticate with your credentials if necessary.
@@ -77,8 +97,9 @@ We will be using OpenShift Data Foundation to simplify application deployment ac
77
97
### Creating Object Bucket Claim
78
98
Object Bucket Claim creates a persistent storage bucket for Velero to store backed up kubernetes manifests.
79
99
80
-
1. Navigate to *Storage* > *Object Bucket CLaim* and click *Create Object Bucket CLaim*
100
+
1. Navigate to *Storage* > *Object Bucket Claim* and click *Create Object Bucket Claim*
81
101

102
+
Note the Project you are currently in. You can create a new Project or leave as *default*
82
103
83
104
2. set the following values:
84
105
- ObjectBucketClaim Name: `oadp-bucket`
@@ -92,8 +113,23 @@ Object Bucket Claim creates a persistent storage bucket for Velero to store back
92
113

93
114
When the *Status* is *Bound*, the bucket is ready.
94
115
95
-
4. Click on oadp-secret in the bottom left to view bucket secrets
96
-
5. Click Reveal values to see the bucket secret values. Copy data from *AWS_ACCESS_KEY_ID* and *AWS_SECRET_ACCESS_KEY* and save it as we'll need it later when installing the OADP Operator.
116
+
### Gathering information from Object Bucket
117
+
1. Click on Object Bucket *obc-default-oadp-bucket* at local endpoint are using is an S3 storage provided by OpenShift Data Foundation with local endpoint at
118
+

119
+
Take note of the following information which may differ from the guide:
120
+
-`.spec.endpoint.bucketName`. Seen in my screenshot as `oadp-bucket-c21e8d02-4d0b-4d19-a295-cecbf247f51f`
121
+
-`.spec.endpoint.bucketHost`: Seen in my screenshot as `s3.openshift-storage.svc`
122
+
123
+
2. Navigate to *Storage* > *Object Bucket Claim* > *oadp-bucket*. Ensure you are in the same *Project* used to create *oadp-bucket*.
124
+
3. Click on oadp-secret in the bottom left to view bucket secrets
125
+
4. Click Reveal values to see the bucket secret values. Copy data from *AWS_ACCESS_KEY_ID* and *AWS_SECRET_ACCESS_KEY* and save it as we'll need it later when installing the OADP Operator.
126
+
127
+
Note: regardless of the cloud provider, the secret field names seen here may contain *AWS_\**.
128
+
5. Now you should have the following information:
129
+
-*bucketName*
130
+
-*bucketHost*
131
+
-*AWS_ACCESS_KEY_ID*
132
+
-*AWS_SECRET_ACCESS_KEY*
97
133
## Deploying an application
98
134
Since we are using OpenShift Data Foundation, we can use common application definition across cloud providers regardless of available storage class.
### Create the DataProtectionApplication Custom Resource
206
+
From side bars navigate to *Operators* > *Installed Operators*
169
207
170
208
Create an instance of the DataProtectionApplication (DPA) CR by clicking on `Create Instance` as highlighted below:
171
209
172
210

173
211
174
-
The Velero instance can be created by selecting configurations using the OCP Web UI or by using a YAML file as mentioned below.
212
+
Select *Configure via*: `YAML view`
175
213
176
-
Finally, set the CR spec values appropriately, and click on `Create`.
214
+
Finally, copy the values provided below and update fields with comments with information obtained earlier.
177
215
178
216
The CR values are mentioned for ease of use. Please remember to mention `default: true` in backupStorageLocations if you intend on using the default backup storage location as shown below.
179
217
180
218
```
181
219
apiVersion: oadp.openshift.io/v1alpha1
182
220
kind: DataProtectionApplication
183
221
metadata:
184
-
name: dpa-sample
222
+
name: example-dpa
223
+
namespace: openshift-adp
185
224
spec:
186
225
configuration:
187
226
velero:
227
+
featureFlags:
228
+
- EnableCSI
188
229
defaultPlugins:
189
230
- openshift
190
231
- aws
191
-
restic:
192
-
enable: true
232
+
- csi
193
233
backupLocations:
194
-
- name: default
195
-
velero:
196
-
provider: aws
234
+
- velero:
197
235
default: true
198
-
objectStorage:
199
-
bucket: my-bucket
200
-
prefix: my-prefix
201
-
config:
202
-
region: us-east-1
203
-
profile: "default"
204
-
credential:
205
-
name: cloud-credentials
206
-
key: cloud
207
-
snapshotLocations:
208
-
- name: default
209
-
velero:
210
236
provider: aws
237
+
credential:
238
+
name: cloud-credentials
239
+
key: cloud
240
+
objectStorage:
241
+
bucket: "oadp-bucket-c21e8d02-4d0b-4d19-a295-cecbf247f51f" #update this
242
+
prefix: velero
211
243
config:
212
-
region: us-west-2
213
-
profile: "default"
214
-
244
+
profile: default
245
+
region: "localstorage"
246
+
s3ForcePathStyle: "true"
247
+
s3Url: "http://s3.openshift-storage.svc/" #update this if necessary
The object storage we are using is an S3 compatible storage provided by OpenShift Data Foundation. We are using custom s3Url capability of the aws velero plugin to access *OpenShift Data Foundation* local endpoint in velero.
218
252
253
+
Click *Create*
219
254
### Verify install
220
255
221
256
To verify all of the correct resources have been created, the following command
@@ -225,9 +260,6 @@ To verify all of the correct resources have been created, the following command
Navigate to *Storage* > *VolumeSnapshotClasses* and click *ocs-storagecluster-rbdplugin-snapclass*
285
+
286
+
Click YAML view to modify values `deletionPolicy` and `labels` as shown below:
287
+
288
+
```diff
289
+
apiVersion: snapshot.storage.k8s.io/v1
290
+
- deletionPolicy: Delete
291
+
+ deletionPolicy: Retain
292
+
driver: openshift-storage.rbd.csi.ceph.com
293
+
kind: VolumeSnapshotClass
294
+
metadata:
295
+
name: ocs-storagecluster-rbdplugin-snapclass
296
+
+ labels:
297
+
+ velero.io/csi-volumesnapshot-class: "true"
298
+
```
299
+
300
+
Setting a `DeletionPolicy` of `Retain` on the *VolumeSnapshotClass* will preserve the volume snapshot in the storage system for the lifetime of the Velero backup and will prevent the deletion of the volume snapshot, in the storage system, in the event of a disaster where the namespace with the *VolumeSnapshot* object may be lost.
301
+
302
+
The Velero CSI plugin, to backup CSI backed PVCs, will choose the VolumeSnapshotClass in the cluster that has the same driver name and also has the velero.io/csi-volumesnapshot-class label set on it.
251
303
## Back up application
304
+
From side menu, navigate to *Operators* > *Installed Operators*
305
+
Under *Project*`openshift-adp`, click on *OADP Operator*.
306
+
Under *Provided APIs* > *Backup*, click on *Create instance*
307
+
308
+

309
+
310
+
In IncludedNamespaces, add `rocket-chat`
252
311
312
+

313
+
314
+
Click *Create*.
315
+
316
+
The status of `restore` should eventually show `Phase: Completed`
253
317
## Uhh what? Disasters?
318
+
Someone forgot their breakfast and their brain is deprived of minerals. They proceeded to delete `rocket-chat` namespace.
319
+
320
+
Navigate to *Home* > *Projects* > `rocket-chat`
321
+

322
+
323
+
Confirm deletion by typing `rocket-chat` and click *Delete*.
324
+
325
+
Wait until Project `rocket-chat` is deleted.
254
326
327
+
Rocket Chat application URL should no longer work.
255
328
## Restore application
329
+
An eternity of time has passed.
330
+
331
+
You finally had breakfast and your brain is working again. Realizing the chat application is down, you decided to restore it.
332
+
333
+
From side menu, navigate to *Operators* > *Installed Operators*
334
+
Under *Project*`openshift-adp`, click on *OADP Operator*.
335
+
Under *Provided APIs* > *Restore*, click on *Create instance*
336
+

337
+
338
+
Under Backup Name, type `backup`
339
+
340
+
In IncludedNamespaces, add `rocket-chat`
341
+
check `restorePVs`
256
342
343
+

344
+
345
+
Click *Create*.
346
+
347
+
The status of `restore` should eventually show `Phase: Completed`.
348
+
349
+
After a few minutes, you should see the chat application up and running.
350
+
You can check via Workloads > Pods > Project: `rocket-chat` and see the following
351
+

352
+
353
+
Try to access the chat application via URL:
354
+
```sh
355
+
oc get route rocket-chat -n rocket-chat -ojsonpath="{.spec.host}"
356
+
```
257
357
## Conclusion
358
+
Phew.. what a ride. We have covered the basic usage of OpenShift API for Data Protection (OADP) Operator, Velero, and the OpenShift Data Foundation.
359
+
360
+
Data is protected! Good bye data loss! Oh, and eat your breakfast people!
If openshift-storage namespace is stuck, follow [troubleshooting guide](https://access.redhat.com/documentation/en-us/red_hat_openshift_data_foundation/4.9/html/troubleshooting_openshift_data_foundation/troubleshooting-and-deleting-remaining-resources-during-uninstall_rhodf).
368
+
If openshift-storage *Project* is stuck, follow [troubleshooting guide](https://access.redhat.com/documentation/en-us/red_hat_openshift_data_foundation/4.9/html/troubleshooting_openshift_data_foundation/troubleshooting-and-deleting-remaining-resources-during-uninstall_rhodf).
265
369
266
370
If you have set velero alias per this guide, you can remove it by running the following command:
0 commit comments