Skip to content

Commit bbdce22

Browse files
committed
Made adjustments after testing.
1 parent 456e0d7 commit bbdce22

File tree

1 file changed

+71
-56
lines changed

1 file changed

+71
-56
lines changed

EKS/Trident-Protect/README.md

Lines changed: 71 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Trident Protect Migrate PVC Storage Class
22

3-
A simple sample for setting up your application to be backed up by Trident Protect with an option for in place migration from EBS to FSx for ONTAP.
3+
This is a sample for setting up your Kubernetes application to be backed up by Trident Protect with an option to migrate it from one storage class to another.
44

55
## Prerequisites:
66
The following items should be already be deployed before install Trident Protect.
7-
- EKS cluster. If you don't already have one, refer to the [FSx for NetApp ONTAP as persistent storage](https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/EKS/FSxN-as-PVC-for-EKS) GitHub repo for an example of how to not only deploy an EKS cluster, but also deploy an FSx for ONTAP file system with Tident installed and its backend and storage classes configured. If you follow it, it will provide the rest of the prerequisites listed below.
7+
- An AWS EKS cluster. If you don't already have one, refer to the [FSx for NetApp ONTAP as persistent storage](https://github.com/NetApp/FSx-ONTAP-samples-scripts/tree/main/EKS/FSxN-as-PVC-for-EKS)
8+
GitHub repo for an example of how to not only deploy an EKS cluster, but also deploy an FSx for ONTAP file system with
9+
Trident installed with its backend and storage classes configured. If you follow it, it will provide the rest of the prerequisites listed below.
810
- Trident installed. Please refer to this [Trident installation documentation](https://docs.netapp.com/us-en/trident/trident-get-started/kubernetes-deploy-helm.html) for the easiest way to do that.
911
- Configure Trident Backend. Refer to the NetApp Trident documentation for guidance on creating [TridentBackendConfig resources](https://docs.netapp.com/us-en/trident/trident-use/backend-kubectl.html).
1012
- Install the Trident CSI drivers for SAN and NAS type storage. Refer to NetApp documentation for [installation instructions](https://docs.netapp.com/us-en/trident/trident-use/trident-fsx-storage-backend.html).
1113
- Configure a StorageClass Trident for SAN and/or NAS type storage. Refer to NetApp documentation for [instructions](https://docs.netapp.com/us-en/trident/trident-use/trident-fsx-storageclass-pvc.html).
1214
- kubectl installed - Refer to [this documentation](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) on how to install it.
1315
- helm installed - Refer to [this documentation](https://helm.sh/docs/intro/install/) on how to install it.
1416

15-
## Preperation
16-
The following are the steps required before you can use Trident Protect to backup your EKS application.
17+
## Preparation
18+
The following are the steps required before you can use Trident Protect to backup or migrate your EKS application.
1719

1820
1. [Configure Trident Backend](#1-make-sure-trident-backend-is-configured-correctly)
1921
1. [Configure Storage Classes for Trident storage types](#2-make-sure-trident-csi-drivers-for-nas-and-san-are-installed)
@@ -37,7 +39,8 @@ kubectl get tbc -n trident -o jsonpath='{.items[?(@.spec.storageDriverName=="ont
3739
kubectl get tbc -n trident -o jsonpath='{.items[?(@.spec.storageDriverName=="ontap-nas")].metadata.name}'
3840
```
3941

40-
If no matching TridentBackendConfig resources are found, you may need to create one. Refer to the prerequisites section above for more information on how to do that.
42+
If no matching TridentBackendConfig resources are found, you will need to create them. Refer to the prerequisites section above for more information on how to do that.
43+
4144
### 2. Make Sure Trident CSI Drivers for NAS and SAN are Installed
4245
Run the follwing kubectl commands to check that a storageclass exist for both SAN and NAS type storage.
4346

@@ -53,10 +56,11 @@ Checks for StorageClasses in Kubernetes that use 'ontap-nas' as their backend ty
5356
kubectl get storageclass -o jsonpath='{.items[?(@.parameters.backendType=="ontap-nas")].metadata.name}'
5457
```
5558

56-
If one or both are not found, you may need to create them. Refer to the prerequisites section above for more information on how to do that.
59+
If one or both are not found, you will need to create them. Refer to the prerequisites section above for more information on how to do that.
5760

5861
### 3. Install the Kubernetes External Snapshotter
59-
Run the following commands to install the Kubernetes External Snapshotter. For more information please consult the official [external-snapshotter documentation](https://github.com/kubernetes-csi/external-snapshotter).
62+
Trident Protect depends on the Snapshotter CRDs and controller. Please run the following commands to install the Kubernetes External Snapshotter.
63+
For more information please consult the official [external-snapshotter documentation](https://github.com/kubernetes-csi/external-snapshotter).
6064

6165
```bash
6266
kubectl kustomize https://github.com/kubernetes-csi/external-snapshotter/client/config/crd | kubectl create -f -
@@ -105,7 +109,7 @@ helm repo add netapp-trident-protect https://netapp.github.io/trident-protect-he
105109
helm install trident-protect-crds netapp-trident-protect/trident-protect-crds --create-namespace --namespace trident-protect
106110
helm install trident-protect netapp-trident-protect/trident-protect --set autoSupport.enabled=false --set clusterName=trident-protect-cluster --namespace trident-protect
107111
```
108-
Note that the above commands should install the latest version. If you want to install a specific version add the --version option and provide the version you want to sue. Please use version `100.2410.1` or later.
112+
Note that the above commands should install the latest version. If you want to install a specific version add the --version option and provide the version you want to use. Please use version `100.2410.1` or later.
109113

110114
### 6. Create Private S3 Bucket for Backup Data and Metadata
111115

@@ -118,13 +122,17 @@ Replace:
118122
- `<aws_region>` the AWS region you want the bucket to reside.
119123

120124
### 7. Create a Kubernetes secret for the S3 bucket
121-
If required, create a service account within AWS IAM that has rights to read and write to the S3 bucketd create. Then create an access key.
125+
If required, create a service account within AWS IAM that has rights to read and write to the S3 bucket create. Then, create an access key.
122126
Once you have the Access Key Id and Secret Access Key, create a Kubernetes secret with the following command:
123127

124128
```markdown
125129
kubectl create secret generic -n trident-protect s3 --from-literal=accessKeyID=<AccessKeyID> --from-literal=secretAccessKey=<secretAccessKey>
126130
```
127131

132+
Replace:
133+
- `<AccessKeyID>` with the Access Key ID.
134+
- `<secretAccessKey>` with the Secret Access Key.
135+
128136
## Configure Trident Protect to backup your application
129137
Preform these steps to configure Trident Protect to backup your application:
130138
- [Define Trident Vault](#define-a-trident-vault-to-store-the-backup)
@@ -161,7 +169,7 @@ spec:
161169

162170
Replace:
163171
- `<APP VAULT NAME>` with the name you want assigned to the Trident Vault
164-
- `<APP VAULT BUCKET NAME>` with the name of the bucket you created in step 5 above.
172+
- `<APP VAULT BUCKET NAME>` with the name of the bucket you created in step 6 above.
165173
- `<S3 ENDPOINT>` the hostname of the S3 endpoint. For example: `s3.us-west-2.amazonaws.com`.
166174

167175
Now run the following command to create the Trident Vault:
@@ -173,10 +181,10 @@ kubectl apply -f trident-vault.yaml
173181
SECURITY NOTE:
174182

175183
If you want to avoid storing AWS credentials explicitly in Kubernetes secrets, a more secure approach would be to use IAM roles for service accounts (IRSA):
176-
- Create an IAM policy with minimal S3 access permissions for the specific bucket.
177-
- Create an IAM role and attach the policy to it.
178-
- Configure your EKS cluster to use IAM roles for service accounts (IRSA).
179-
- Create a Kubernetes service account in the trident-protect namespace and associate it with the IAM role
184+
- Create an IAM policy with minimal S3 access permissions for the specific bucket.
185+
- Create an IAM role and attach the policy to it.
186+
- Configure your EKS cluster to use IAM roles for service accounts (IRSA).
187+
- Create a Kubernetes service account in the trident-protect namespace and associate it with the IAM role
180188

181189
### Create a Trident Application
182190
You create a Trident application with the specification of your application in order to back it up. You do that by creating a file named `trident-application.yaml` with the following contents:
@@ -203,7 +211,7 @@ kubectl apply -f trident-application.yaml
203211
```
204212

205213
### Run Backup for Application
206-
To perform an on-demand backup of the application first create a backup configuration file named `trident-backup.yaml` with the following contents:
214+
To perform an on-demand backup of the application, first create a backup configuration file named `trident-backup.yaml` with the following contents:
207215

208216
```markdown
209217
apiVersion: protect.trident.netapp.io/v1
@@ -235,97 +243,104 @@ To check the status of the backup run the following command:
235243
kubectl get backup -n <APP NAMESPACE> <APP BACKUP NAME> -o jsonpath='{.status.state}'
236244
```
237245

238-
- If status is `Completed` Backup completed successfully
239-
- If status is `Running` run the command again in a few minutes to check status
240-
- If status is `Failed` check the error message:
246+
- If status is `Completed` Backup completed successfully .
247+
- If status is `Running` run the command again in a few minutes to check status.
248+
- If status is `Failed` or `Error` check the error message with:
241249

242250
```markdown
243251
kubectl get backup -n <APP NAMESPACE> <APP BACKUP NAME> -o jsonpath='{.status.error}'
244252
```
245-
## Perform an restore of the backup
253+
254+
## Perform a Restore of a Backup
246255
There are two ways to restore a backup:
247-
- [Restore backup to a different namespace](#restore-backup-to-a-different-namespace)
248256
- [Restore backup to the same namespace](#restore-backup-to-the-same-namespace)
257+
- [Restore backup to a different namespace](#restore-backup-to-a-different-namespace)
249258

250-
### Restore backup to a different namespace
251-
To restore the backup you created above to a different namespace, you first need to create a restore configuration file named `trident-restore.yaml` with the following contents:
259+
### Restore backup to the same namespace
260+
To restore your appilcation in the same namespace, create an `BackupInPlaceRestore` configuration file named `backupinplacerestore.yaml` with the following contents:
252261

253262
```markdown
254263
apiVersion: protect.trident.netapp.io/v1
255-
kind: BackupRestore
264+
kind: BackupInplaceRestore
256265
metadata:
257-
name: <APP RESTORE NAME>
258-
namespace: <DESTINATION NAMESPACE>
266+
name: <APP BACKUP RESTORE NAME>
267+
namespace: <APP NAMESPACE>
259268
spec:
260269
appArchivePath: <APP ARCHIVE PATH>
261270
appVaultRef: <APP VAULT NAME>
262-
namespaceMapping:
263-
- source: <SOURCE NAMESPACE>
264-
destination: <DESTINATION NAMESPACE>
265271
```
266272

267-
Where:
268-
- `<APP RESTORE NAME>` with the name you want to assign the restore configuration
269-
- `<DESTINATION NAMESPACE>` with the namespace where you want to restore the application
270-
- `<APP VAULT NAME>` with the name of the backup configuration used to create the backup you want to restore from.
271-
- `<SOURCE NAMESPACE>` with the namespace where the application was backed up from.
272-
- `<DESTINATION NAMESPACE>` with the namespace where you want the application to be restored to.
273-
- `<APP ARCHIVE PATH>` with the path to the backup archive. You can get this by running the following command:
273+
Replace:
274+
- `<APP BACKUP RESTORE NAME>` with the name you want to assign the restore configuration
275+
- `<APP NAMESPACE>` with the namespace where the application was backed up from.
276+
- `<APP VAULT NAME>` with the name of the backup configuration used to create the backup you want to restore from.
277+
- `<APP ARCHIVE PATH>` with the path to the backup archive. You can get this by running the following command:
278+
274279
```markdown
275280
kubectl get backup -n <APP NAMESPACE> <APP BACKUP NAME> -o jsonpath='{.status.appArchivePath}'
276281
```
277282

278-
Run the following command to start the restore:
283+
Once the yaml file is created, run the following command to start the restore:
279284

280285
```markdown
281-
kubectl apply -f trident-restore.yaml
286+
kubectl apply -f backupinplacerestore.yaml
282287
```
283288

284-
You can check the status of the restore by running the following command:
289+
Verify application restore was successful run the following command:
285290

286291
```markdown
287-
kubectl get backuprestore -n <DESTINATION NAMESPACE> <APP RESTORE NAME> -o jsonpath='{.status.state}'
292+
kubectl get <APP BACKUP RESTORE NAME> -n <APP NAMESPACE> -o jsonpath='{.status.state}'
288293
```
289294

290-
## Restore backup to the same namespace
291-
Run the restore by first creating an in place restore configuration file named `backupinplacerestore.yaml` with the following contents:
295+
### Restore backup to a different namespace
296+
To restore the backup to a different namespace and optionally to a different storage class, you first need to create a restore configuration file named `trident-migrate.yaml` with the following contents:
292297

293298
```markdown
294299
apiVersion: protect.trident.netapp.io/v1
295-
kind: BackupInplaceRestore
300+
kind: BackupRestore
296301
metadata:
297-
name: <APP BACKUP RESTORE NAME>
298-
namespace: <APP NAMESPACE>
302+
name: <APP RESTORE NAME>
303+
namespace: <DESTINATION NAMESPACE>
299304
spec:
300305
appArchivePath: <APP ARCHIVE PATH>
301306
appVaultRef: <APP VAULT NAME>
302-
storageClassMapping:
307+
namespaceMapping:
308+
- source: <SOURCE NAMESPACE>
309+
destination: <DESTINATION NAMESPACE>
310+
storageClassMapping:
303311
- source: <SOURCE STORAGE CLASS>
304312
destination: <DESTINATION STORAGE CLASS>
305313
```
306314

307315
Replace:
308-
- `<APP BACKUP RESTORE NAME>` with the name you want to assign the restore configuration
309-
- `<APP NAMESPACE>` with the namespace where the application was backed up from.
310-
- `<APP VAULT NAME>` with the name of the backup configuration used to create the backup you want to restore from.
311-
- `<SOURCE STORAGE CLASS>` with the storage class of the PVC you want to migrate from.
312-
- `<DESTINATION STORAGE CLASS>` with the storage class of the PVC you want to migrate to.
316+
- `<APP RESTORE NAME>` with the name you want to assign the restore configuration.
317+
- `<DESTINATION NAMESPACE>` with the namespace where you want to restore the application.
318+
- `<APP VAULT NAME>` with the name of the Trident Vault used when creating the backup.
319+
- `<SOURCE NAMESPACE>` with the namespace where the application was backed up from.
320+
- `<DESTINATION NAMESPACE>` with the namespace where you want the application to be restored to.
321+
- `<SOURCE STORAGE CLASS>` with the name of storage class of the PVCs in the source namespace.
322+
- `<DESTINATION STORAGE CLASS>` with the name of storage class you want to be used for the PVC(s) when the data is restored.
313323
- `<APP ARCHIVE PATH>` with the path to the backup archive. You can get this by running the following command:
314324

325+
Note that with the above example, you are migrating the PVCs from one storage class to another. If you don't want to do that, you can remove the `storageClassMapping` section from the yaml file.
326+
315327
```markdown
316328
kubectl get backup -n <APP NAMESPACE> <APP BACKUP NAME> -o jsonpath='{.status.appArchivePath}'
317329
```
318330

319-
Note in the above example, not only are we reestoring to the same namespace, but we are also migrating the PVCs from one storage class to anther. If you don't want to do that, you can remove the `storageClassMapping` section from the yaml file.
320-
321-
Once the yaml file is created, run the following command to start the restore:
331+
Run the following command to start the restore:
322332

323333
```markdown
324-
kubectl apply -f backupinplacerestore.yaml
334+
kubectl apply -f trident-migrate.yaml
325335
```
326336

327-
Verify application restore was successful run the following command:
337+
You can check the status of the restore by running the following command:
328338

329339
```markdown
330-
kubectl get <APP BACKUP RESTORE NAME> -n <APP NAMESPACE> -o jsonpath='{.status.state}'
340+
kubectl get backuprestore -n <DESTINATION NAMESPACE> <APP RESTORE NAME> -o jsonpath='{.status.state}'
331341
```
342+
343+
## Final Notes
344+
This is a simple example of how to use Trident Protect to backup and restore your application.
345+
There are a lot of other features and options available with Trident Protect that are not covered here.
346+
For more information please refer to the official [Trident Protect documentation](https://docs.netapp.com/us-en/trident/trident-protect/trident-protect-installation.html).

0 commit comments

Comments
 (0)