loading...
Cover image for How to use Persistent Storage in OpenShift?

How to use Persistent Storage in OpenShift?

sagarjadhv23 profile image Sagar Jadhav Updated on ・1 min read

OpenShift Essentials (8 Part Series)

1) How to manage Users & Project in Openshift? 2) How to create route in OpenShift? 3 ... 6 3) How to scale an application in OpenShift? 4) How to use Persistent Storage in OpenShift? 5) How to deploy application using Source to Image (S2I) in OpenShift? 6) How to monitor application using probes in OpenShift? 7) How to limit resources using Quotas & Limit Ranges in OpenShift? 8) How to deploy an application using Templates in OpenShift?

Objective

  • Deploy Mongodb Application
  • Create PersistentVolumeClaim
  • Assign PersistentVolumeClaim to Mongodb Application
  • Verify that data gets stored in Persistent Storage

Step 1: Set up OpenShift environment

Go to Katacoda.com & click on start scenario

Step 2: Update environment permissions

setenforce 0

Step 3: Deploy mongodb application

oc new-app --name mongo -l app=db --docker-image=centos/mongodb-36-centos7 -e MONGODB_ADMIN_PASSWORD=secret

Step 4: List pods

oc get pods

Step 5: Describe pod

oc describe pod <POD_NAME>

Step 6: Create PersistentVolumeClaim & assign it to mongodb application

oc set volume dc/mongo --add --name=<PVC_NAME> -t pvc --claim-size=10Gi  --overwrite --claim-mode="ReadWriteMany"
Example: oc set volume dc/mongo --add --name=mongo-volume-1 -t pvc --claim-size=10Gi  --overwrite --claim-mode="ReadWriteMany"

Step 7: List PersistentVolumeClaims (PVC's)

oc get pvc

Step 8: List PersistentVolumes (PV's)

oc get pv

Step 9: Describe pod

oc describe pod <POD_NAME>

Step 10: Describe PersistentVolume (PV)

oc describe pv <PV_NAME>

Step 11: List files

Go to PV location

ls

OpenShift Essentials (8 Part Series)

1) How to manage Users & Project in Openshift? 2) How to create route in OpenShift? 3 ... 6 3) How to scale an application in OpenShift? 4) How to use Persistent Storage in OpenShift? 5) How to deploy application using Source to Image (S2I) in OpenShift? 6) How to monitor application using probes in OpenShift? 7) How to limit resources using Quotas & Limit Ranges in OpenShift? 8) How to deploy an application using Templates in OpenShift?

Posted on by:

sagarjadhv23 profile

Sagar Jadhav

@sagarjadhv23

Backend Developer (Cloud ☁️) | Cloud Technology Enthusiast (🐳 ☸) Redhat Certified OpenShift Administrator

Discussion

markdown guide