Introduction to Persistent Storage In OpenShift

openshift persistent volumes

Not all the containers in your cluster will be non-persistent or ephemeral. Most of the time you will need persistent containers running all around the place to hold some sort of data. To store the data independent of the lifetime of your containers, you need to configure some sort of persistent storage.

OpenShift uses Persistent Volume (PV) framework of Kubernetes to provision persistent storage for a cluster. Persistent Volumes are bound to pods using Persistent Volume Claims (PVC). Using PVCs, you can request Persistent Volume resources without having specific knowledge of the underlying storage technology.

PV API and PVC API

PVs are defined by a PersistentVolume API object and PVCs are defined by a PersitentVolumeClaim API object. PersistentVolume API object represents a piece of networked storage in the cluster. PV objects capture the details of the underlying storage technology. PersitentVolumeClaim API object represents a request for storage. PVCs can be used to request a specific storage capacity and access mode.

Persistent Volumes are not bound to any specific project (namespace) scope. They can be shared across the whole cluster. Persistent Volume Claims are specific to a project and are used as a means to use PVs. The lifecycle of a Persistent Volume is independent of any POD using it. PVs are resources in the cluster like nodes are.

Binding

A control process inside the master watches for new PVCs, finds a matching PV and binds them together. Here the bound volume can be more than what was requested. To minimize this excess binding, OpenShift  tries to bind to the smallest matching PV.

Persistent Volume Claims will stay unbound unless a matching Persistent Volume is  provisioned. For example, if you have a PVC asking for 50 GB of storage and you have three 25 GB storage PVs this PVC will not bound to any Persistent Volumes. It wait until a PV with 50 GB of storage and the correct access mode is provisioned.

Release and Reclaim

When a PVC is bound to a PV, that PV belongs to the pod for as long as it is needed. To release a PV, the bound PVC has to be deleted. Once the bound PVC is deleted the associated PV is considered released. In this state the previous claimer’s data is still on the PV and it is not available for re-binding. Reclaim Policy of the PV tells the cluster what to do when it becomes “released”. In this case, a PV can be either retained or recycled.

recycled -> Volume is cleared and made available again

retained -> Data stays. Volume can be cleared and re-claimed manually

Supported Persistent Volume Types

OpenShift supports various Persistent Volume plug-ins:
NFS
HostPath
GlusterFS
Ceph RBD
OpenStack Cinder
AWS Elastic Block Store (EBS)
GCE Persistent Disk
iSCSI
Fibre Channel
Azure Disk
Azure File

Storage High Availability

High-availability of storage in the infrastructure is left to the underlying storage provider. If you want to obtain high-availability for your storage layer see OpenShift Container Storage.

Hope this helps.
Good Luck,
Serdar