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
Copy file name to clipboardExpand all lines: EKS/Trident-Protect/README.md
+71-56Lines changed: 71 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,21 @@
1
1
# Trident Protect Migrate PVC Storage Class
2
2
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.
4
4
5
5
## Prerequisites:
6
6
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.
8
10
- 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.
9
11
- 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).
10
12
- 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).
11
13
- 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).
12
14
- kubectl installed - Refer to [this documentation](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) on how to install it.
13
15
- helm installed - Refer to [this documentation](https://helm.sh/docs/intro/install/) on how to install it.
14
16
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.
kubectl get tbc -n trident -o jsonpath='{.items[?(@.spec.storageDriverName=="ontap-nas")].metadata.name}'
38
40
```
39
41
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
+
41
44
### 2. Make Sure Trident CSI Drivers for NAS and SAN are Installed
42
45
Run the follwing kubectl commands to check that a storageclass exist for both SAN and NAS type storage.
43
46
@@ -53,10 +56,11 @@ Checks for StorageClasses in Kubernetes that use 'ontap-nas' as their backend ty
53
56
kubectl get storageclass -o jsonpath='{.items[?(@.parameters.backendType=="ontap-nas")].metadata.name}'
54
57
```
55
58
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.
57
60
58
61
### 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).
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.
109
113
110
114
### 6. Create Private S3 Bucket for Backup Data and Metadata
111
115
@@ -118,13 +122,17 @@ Replace:
118
122
-`<aws_region>` the AWS region you want the bucket to reside.
119
123
120
124
### 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.
122
126
Once you have the Access Key Id and Secret Access Key, create a Kubernetes secret with the following command:
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
180
188
181
189
### Create a Trident Application
182
190
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:
-[Restore backup to a different namespace](#restore-backup-to-a-different-namespace)
248
256
-[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)
249
258
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:
252
261
253
262
```markdown
254
263
apiVersion: protect.trident.netapp.io/v1
255
-
kind: BackupRestore
264
+
kind: BackupInplaceRestore
256
265
metadata:
257
-
name: <APP RESTORE NAME>
258
-
namespace: <DESTINATION NAMESPACE>
266
+
name: <APP BACKUP RESTORE NAME>
267
+
namespace: <APP NAMESPACE>
259
268
spec:
260
269
appArchivePath: <APP ARCHIVE PATH>
261
270
appVaultRef: <APP VAULT NAME>
262
-
namespaceMapping:
263
-
- source: <SOURCE NAMESPACE>
264
-
destination: <DESTINATION NAMESPACE>
265
271
```
266
272
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:
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:
292
297
293
298
```markdown
294
299
apiVersion: protect.trident.netapp.io/v1
295
-
kind: BackupInplaceRestore
300
+
kind: BackupRestore
296
301
metadata:
297
-
name: <APP BACKUP RESTORE NAME>
298
-
namespace: <APP NAMESPACE>
302
+
name: <APP RESTORE NAME>
303
+
namespace: <DESTINATION NAMESPACE>
299
304
spec:
300
305
appArchivePath: <APP ARCHIVE PATH>
301
306
appVaultRef: <APP VAULT NAME>
302
-
storageClassMapping:
307
+
namespaceMapping:
308
+
- source: <SOURCE NAMESPACE>
309
+
destination: <DESTINATION NAMESPACE>
310
+
storageClassMapping:
303
311
- source: <SOURCE STORAGE CLASS>
304
312
destination: <DESTINATION STORAGE CLASS>
305
313
```
306
314
307
315
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.
313
323
-`<APP ARCHIVE PATH>` with the path to the backup archive. You can get this by running the following command:
314
324
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.
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:
322
332
323
333
```markdown
324
-
kubectl apply -f backupinplacerestore.yaml
334
+
kubectl apply -f trident-migrate.yaml
325
335
```
326
336
327
-
Verify application restore was successful run the following command:
337
+
You can check the status of the restore by running the following command:
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