Skip to content

Commit da23309

Browse files
committed
update
1 parent a7af300 commit da23309

11 files changed

+144
-40
lines changed
530 KB
Loading

blogs/oadp-odf/backupRocketChat.png

442 KB
Loading

blogs/oadp-odf/create-dpa-cr-yaml.png

743 KB
Loading
510 KB
Loading

blogs/oadp-odf/deleteRocketChat.png

507 KB
Loading

blogs/oadp-odf/firstMessageNew.png

223 KB
Loading

blogs/oadp-odf/oadp-blog.md

Lines changed: 144 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,35 @@ The OpenShift API for Data Protection (OADP) is designed to protect Application
1414

1515
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.
1616

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)
22+
- [Creating StorageSystem](#creating-storagesystem)
23+
- [Creating Object Bucket Claim](#creating-object-bucket-claim)
24+
- [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 -->
1937
<!-- - Local Storage Operator -->
20-
- OpenShift Data Foundation
38+
<!-- - OpenShift Data Foundation
2139
- OpenShift API for Data Protection Operator
2240
- Application deployment
2341
- Application protection
2442
- 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.
2646
## Pre-requisites
2747
- Terminal environment
2848
- Your terminal has the following commands
@@ -46,7 +66,7 @@ We will be using OpenShift Data Foundation to simplify application deployment ac
4666

4767
1. Open the OpenShift Web Console by navigating to the url below, make sure you are in Administrator view, not Developer.
4868

49-
```
69+
```sh
5070
oc get route console -n openshift-console -ojsonpath="{.spec.host}"
5171
```
5272
Authenticate with your credentials if necessary.
@@ -77,8 +97,9 @@ We will be using OpenShift Data Foundation to simplify application deployment ac
7797
### Creating Object Bucket Claim
7898
Object Bucket Claim creates a persistent storage bucket for Velero to store backed up kubernetes manifests.
7999

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*
81101
![](ObjectBucketClaimCreate.png)
102+
Note the Project you are currently in. You can create a new Project or leave as *default*
82103

83104
2. set the following values:
84105
- ObjectBucketClaim Name: `oadp-bucket`
@@ -92,8 +113,23 @@ Object Bucket Claim creates a persistent storage bucket for Velero to store back
92113
![](ObjectBucketClaimReady.png)
93114
When the *Status* is *Bound*, the bucket is ready.
94115

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+
![](obc-default-oadp-bucket.png)
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*
97133
## Deploying an application
98134
Since we are using OpenShift Data Foundation, we can use common application definition across cloud providers regardless of available storage class.
99135

@@ -109,7 +145,7 @@ oc apply -f apps/rocket-chat/manifests/
109145
```
110146

111147
Navigate to rocket-chat setup wizard url obtained by this command into your browser.
112-
```
148+
```sh
113149
oc get route rocket-chat -n rocket-chat -ojsonpath="{.spec.host}"
114150
```
115151

@@ -137,21 +173,22 @@ Now click on `Install`
137173

138174
<!-- ![OADP-OLM-1](/docs/images/click-install.png) -->
139175

140-
Finally, click on `Install` again. This will create namespace `openshift-adp`
176+
Finally, click on `Install` again. This will create *Project* `openshift-adp`
141177
if it does not exist, and install the OADP operator in it.
142178

143179
<!-- ![OADP-OLM-1](/docs/images/click-install-again.png) -->
144180

145181
### Create credentials secret for OADP Operator to use
146-
We will now create secret `cloud-credentials` using values obtained from Object Bucket Claim in namespace `openshift-adp`.
182+
We will now create secret `cloud-credentials` using values obtained from Object Bucket Claim in *Project* `openshift-adp`.
147183

148184
From OpenShift Web Console side bar navigate to *Workloads* > *Secrets* and click *Create* > Key/value secret
149185
![](secretKeyValCreate.png)
150186

151187
Fill out the following fields:
152188
- Secret name: `cloud-credentials`
189+
- Key: `cloud`
153190
- Value:
154-
- Replace the values with your own values and enter it in the value field.
191+
- Replace the values with your own values from earlier steps and enter it in the value field.
155192
```
156193
[default]
157194
aws_access_key_id=<INSERT_VALUE>
@@ -166,56 +203,54 @@ $ oc create secret generic cloud-credentials --namespace openshift-adp --from-fi
166203
``` -->
167204
168205
### Create the DataProtectionApplication Custom Resource
206+
From side bars navigate to *Operators* > *Installed Operators*
169207
170208
Create an instance of the DataProtectionApplication (DPA) CR by clicking on `Create Instance` as highlighted below:
171209
172210
![Velero-CR-1](/docs/images/dpa-cr.png)
173211
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`
175213
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.
177215
178216
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.
179217
180218
```
181219
apiVersion: oadp.openshift.io/v1alpha1
182220
kind: DataProtectionApplication
183221
metadata:
184-
name: dpa-sample
222+
name: example-dpa
223+
namespace: openshift-adp
185224
spec:
186225
configuration:
187226
velero:
227+
featureFlags:
228+
- EnableCSI
188229
defaultPlugins:
189230
- openshift
190231
- aws
191-
restic:
192-
enable: true
232+
- csi
193233
backupLocations:
194-
- name: default
195-
velero:
196-
provider: aws
234+
- velero:
197235
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:
210236
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
211243
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
215248
```
249+
![Velero-CR-2](create-dpa-cr-yaml.png)
216250
217-
![Velero-CR-2](/docs/images/create-dpa-cr-yaml.png)
251+
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.
218252
253+
Click *Create*
219254
### Verify install
220255
221256
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
225260
NAME READY STATUS RESTARTS AGE
226261
pod/oadp-operator-controller-manager-67d9494d47-6l8z8 2/2 Running 0 2m8s
227262
pod/oadp-velero-sample-1-aws-registry-5d6968cbdd-d5w9k 1/1 Running 0 95s
228-
pod/restic-9cq4q 1/1 Running 0 94s
229-
pod/restic-m4lts 1/1 Running 0 94s
230-
pod/restic-pv4kr 1/1 Running 0 95s
231263
pod/velero-588db7f655-n842v 1/1 Running 0 95s
232264

233265
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
@@ -248,20 +280,92 @@ replicaset.apps/oadp-velero-sample-1-aws-registry-5d6968cbdd 1 1
248280
replicaset.apps/velero-588db7f655 1 1 1 96s
249281
```
250282
283+
### Modifying VolumeSnapshotClass
284+
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.
251303
## 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+
![](backupCreateInstance.png)
309+
310+
In IncludedNamespaces, add `rocket-chat`
252311

312+
![](backupRocketChat.png)
313+
314+
Click *Create*.
315+
316+
The status of `restore` should eventually show `Phase: Completed`
253317
## 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+
![](deleteRocketChat.png)
322+
323+
Confirm deletion by typing `rocket-chat` and click *Delete*.
324+
325+
Wait until Project `rocket-chat` is deleted.
254326

327+
Rocket Chat application URL should no longer work.
255328
## 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+
![](createRestoreInstance.png)
337+
338+
Under Backup Name, type `backup`
339+
340+
In IncludedNamespaces, add `rocket-chat`
341+
check `restorePVs`
256342

343+
![](restoreRocketChat.png)
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+
![](rocketChatReady.png)
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+
```
257357
## 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!
361+
258362

259363
### Remove workloads from this guide
260364
```sh
261365
oc delete ns openshift-adp rocket-chat openshift-storage
262366
```
263367

264-
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).
265369

266370
If you have set velero alias per this guide, you can remove it by running the following command:
267371
```sh
554 KB
Loading

blogs/oadp-odf/restoreRocketChat.png

479 KB
Loading

blogs/oadp-odf/rocketChatReady.png

416 KB
Loading

0 commit comments

Comments
 (0)