Red Hat OpenShift Service on AWS with NetApp ONTAP
This document will outline how to use NetApp ONTAP with the Red Hat OpenShift Service on AWS (ROSA).
Create Volume Snapshot
1. Create a Snapshot of the app volume
In this section, we will show how to create a trident snapshot of the volume associated with the app.This will be a point in time copy of the app data. If the application data is lost, we can recover the data from this point in time copy.
NOTE: This snapshot is stored in the same aggregate as the original volume in ONTAP(on-premises or in the cloud). So if the ONTAP storage aggregate is lost, we cannot recover the app data from its snapshot.
**a. Create a VolumeSnapshotClass
Save the following manifest in a file called volume-snapshot-class.yaml
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: fsx-snapclass
driver: csi.trident.netapp.io
deletionPolicy: Delete
Create a snapshot by using the above manifest.
b. Next, create a snapshot
Create a snapshot of the existing PVC by creating VolumeSnapshot to take a point-in-time copy of your Postgresql data. This creates an FSx snapshot that takes almost no space in the filesystem backend. Save the following manifest in a file called volume-snapshot.yaml:
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: postgresql-volume-snap-01
spec:
volumeSnapshotClassName: fsx-snapclass
source:
persistentVolumeClaimName: data-postgresql-0
c. Create the volume snapshot and confirm that it is created
Delete the database to simulate the loss of data (data loss can happen due to a variety of reasons, here we are just simulating it by deleting the database)
d. Delete the database to simulate the loss of data (data loss can happen due to a variety of reasons, here we are just simulating it by deleting the database)
Restore from Volume Snapshot
1. Restore from Snapshot
In this section, we will show how to restore an application from the trident snapshot of the app volume.
a. Create a volume clone from the snapshot
To restore the volume to its previous state, you must create a new PVC based on the data in the snapshot you took. To do this, save the following manifest in a file named pvc-clone.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgresql-volume-clone
spec:
accessModes:
- ReadWriteOnce
storageClassName: trident-csi
resources:
requests:
storage: 8Gi
dataSource:
name: postgresql-volume-snap-01
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
Create a clone of the volume by creating a PVC using the snapshot as the source using the above manifest. Apply the manifest and ensure that the clone is created.
b. Delete the original postgresql installation
c. Create a new postgresql application using the new clone PVC
$ helm install postgresql bitnami/postgresql --set primary.persistence.enabled=true --set primary.persistence.existingClaim=postgresql-volume-clone -n postgresql
d. Verify that the application pod is in the running state
e. Verify that the pod uses the clone as its PVC
f) To validate that the database has been restored as expected, go back to the container console and show the existing databases
Demo video
More videos on Red Hat OpenShift and OpenShift solutions can be found here.