Red Hat OpenShift Service on AWS (ROSA) (classic architecture) and Red Hat OpenShift Service on AWS (ROSA) support storing persistent volumes with either Amazon Web Services (AWS) Elastic Block Store (EBS) or AWS Elastic File System (EFS).
Use the following procedures to create a file, store it on a persistent volume in your cluster, and confirm that it still exists after pod failure and re-creation.
Navigate to the cluster’s OpenShift web console.
Click Storage in the left menu, then click PersistentVolumeClaims to see a list of all the persistent volume claims.
Click a persistence volume claim to see the size, access mode, storage class, and other additional claim details.
The access mode is |
In the OSToy app console, click Persistent Storage in the left menu.
In the Filename box, enter a file name with a .txt
extension, for example test-pv.txt
.
In the File contents box, enter a sentence of text, for example OpenShift is the greatest thing since sliced bread!
.
Click Create file.
Scroll to Existing files on the OSToy app console.
Click the file you created to see the file name and contents.
Wait for the pod to re-create.
On the OSToy app console, click Persistent Storage in the left menu.
Find the file you created, and open it to view and confirm the contents.
The deployment YAML file shows that we mounted the directory /var/demo_files
to our persistent volume claim.
Retrieve the name of your front-end pod by running the following command:
$ oc get pods
Start a secure shell (SSH) session in your container by running the following command:
$ oc rsh <pod_name>
Go to the directory by running the following command:
$ cd /var/demo_files
Optional: See all the files you created by running the following command:
$ ls
Open the file to view the contents by running the following command:
$ cat test-pv.txt
Verify that the output is the text you entered in the OSToy app console.
$ oc get pods
NAME READY STATUS RESTARTS AGE
ostoy-frontend-5fc8d486dc-wsw24 1/1 Running 0 18m
ostoy-microservice-6cf764974f-hx4qm 1/1 Running 0 18m
$ oc rsh ostoy-frontend-5fc8d486dc-wsw24
$ cd /var/demo_files/
$ ls
lost+found test-pv.txt
$ cat test-pv.txt
OpenShift is the greatest thing since sliced bread!
For more information about persistent volume storage, see Understanding persistent storage.
For more information about ROSA storage options, see Storage overview.