Spread the love We all know by now, that Kubernetes and openshift provides us the ability to host our containerised
We all know by now, that Kubernetes and openshift provides us the ability to host our containerised applications in the PaaS platform in the form of Openshift POD, which is a wrapper around one or more running containers.
However, it’s not necessary that every time we need ephemeral pod or applications. Consider a scenario where you are running an instance of mysql database in the openshift platform which hosting your application’s database.
A pod is supposed to be short lived entity, they are tend to die, which means whenever that pod restart’s or recreated it’s not the same previous pod but the new pod start every time ( you may notice it’s ip changes ) every time it restarts.
So, if you restart a pod which is hosting your mysql database, it will drop/delete all the stored data ( database/tables ) written on it. and you will lose all of your application’s critical data.
To over come this situation, openshift provides a feature called persistent volumes & persistent volume claims ( pv and pvc). which provides storage capability to your pod, you may write your required files into this storage and attach it with your pod. which means even after pod restarts you have no impact of your stored data ( as it’s stored outside of pod’s process ).
Persistant Volume : it’s the chunk of memory you allocate in bulk and attach to the project. so that multiple applications running under same project can use their required storage and attach it with pod, you need to manually attach this storage with required pod via claim.
Persistant Volume Claim: Persistent volume claim with be the chunk which has been claimed by an individual pod from the available persistent space ( PV).
That means, ideally, Openshift administrator will be responsible for creating the persistent volumes and attach them with openshift project. It’s the developer’s responsibility to make/ initiate the claim from that available storage to utilise to use in their pod.
PV has one to one relationship with running pod with which it attached.
Example : 50 GB PV (10 x 5) has been created and attached to the openshift project A, this project has 5 running pod/applications which required 10GB of storage each. So, administrator will create a 5 10GB pv’s and at the runtime ( whenever required ) developers will initiate the pvc for storage they want to attach in their pod, in this case it’s 10gb pvc.