Managing storage is a distinct problem from managing compute resources. OpenShift Dedicated uses the Kubernetes persistent volume (PV) framework to allow cluster administrators to provision persistent storage for a cluster. Developers can use persistent volume claims (PVCs) to request PV resources without having specific knowledge of the underlying storage infrastructure.

PVCs are specific to a project and are created and used by developers as a means to use a PV. PV resources on their own are not scoped to any single project; they can be shared across the entire OpenShift Dedicated cluster and claimed from any project. After a PV is bound to a PVC, however, that PV cannot then be bound to additional PVCs. This has the effect of scoping a bound PV to a single namespace (that of the binding project).

PVs are defined by a PersistentVolume API object, which represents a piece of existing, networked storage in the cluster that was provisioned by the cluster administrator. It is a resource in the cluster just like a node is a cluster resource. PVs are volume plug-ins like Volumes but have a lifecycle that is independent of any individual pod that uses the PV. PV objects capture the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.

High availability of storage in the infrastructure is left to the underlying storage provider.

PVCs are defined by a PersistentVolumeClaim API object, which represents a request for storage by a developer. It is similar to a pod in that pods consume node resources and PVCs consume PV resources. For example, pods can request specific levels of resources (e.g., CPU and memory), while PVCs can request specific storage capacity and access modes (e.g., they can be mounted once read/write or many times read-only).

Lifecycle of a volume and claim

PVs are resources in the cluster. PVCs are requests for those resources and also act as claim checks to the resource. The interaction between PVs and PVCs have the following lifecycle.

Provision storage

In response to requests from a developer defined in a PVC, a cluster administrator configures one or more dynamic provisioners that provision storage and a matching PV.

Alternatively, a cluster administrator can create a number of PVs in advance that carry the details of the real storage that is available for use. PVs exist in the API and are available for use.

Bind claims

When you create a PVC, you request a specific amount of storage, specify the required access mode, and create a storage class to describe and classify the storage. The control loop in the master watches for new PVCs and binds the new PVC to an appropriate PV. If an appropriate PV does not exist, a provisioner for the storage class creates one.

The PV volume might exceed your requested volume. This is especially true with manually provisioned PVs. To minimize the excess, OpenShift Dedicated binds to the smallest PV that matches all other criteria.

Claims remain unbound indefinitely if a matching volume does not exist or cannot be created with any available provisioner servicing a storage class. Claims are bound as matching volumes become available. For example, a cluster with many manually provisioned 50Gi volumes would not match a PVC requesting 100Gi. The PVC can be bound when a 100Gi PV is added to the cluster.

Use pods and claimed PVs

Pods use claims as volumes. The cluster inspects the claim to find the bound volume and mounts that volume for a pod. For those volumes that support multiple access modes, you must specify which mode applies when you use the claim as a volume in a pod.

After you have a claim and that claim is bound, the bound PV belongs to you for as long as you need it. You can schedule pods and access claimed PVs by including persistentVolumeClaim in the pod’s volumes block. See below for syntax details.

Release volumes

When you are finished with a volume, you can delete the PVC object from the API, which allows reclamation of the resource. The volume is considered "released" when the claim is deleted, but it is not yet available for another claim. The previous claimant’s data remains on the volume and must be handled according to policy.

Reclaim volumes

The reclaim policy of a PersistentVolume tells the cluster what to do with the volume after it is released. A PV’s reclaim policy can be either Retain or Delete.

  • Retain reclaim policy allows manual reclamation of the resource for those volume plug-ins that support it.

  • Delete reclaim policy deletes both the PersistentVolume object from OpenShift Dedicated and the associated storage asset in external infrastructure, such as AWS EBS, GCE PD, or Cinder volume.

Dynamically provisioned volumes have a default ReclaimPolicy value of Delete. Manually provisioned volumes have a default ReclaimPolicy value of Retain.

Reclaim a PersistentVolume Manually

When a PersistentVolumeClaim is deleted, the PersistentVolume still exists and is considered "released". However, the PV is not yet available for another claim because the previous claimant’s data remains on the volume.

To manually reclaim the PV as a cluster administrator:

  1. Delete the PV.

    $ oc delete <pv-name>

    The associated storage asset in the external infrastructure, such as an AWS EBS, GCE PD, Azure Disk, or Cinder volume, still exists after the PV is deleted.

  2. Clean up the data on the associated storage asset.

  3. Delete the associated storage asset. Alternately, to reuse the same storage asset, create a new PV with the storage asset definition.

The reclaimed PV is now available for use by another PVC.

Change the reclaim policy

To change the reclaim policy of a PV:

  1. List the PVs in your cluster:

    $ oc get pv
    Example Output
    NAME                                       CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS    CLAIM             STORAGECLASS     REASON    AGE
     pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94   4Gi        RWO           Delete          Bound     default/claim1    manual                     10s
     pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94   4Gi        RWO           Delete          Bound     default/claim2    manual                     6s
     pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94   4Gi        RWO           Delete          Bound     default/claim3    manual                     3s
  2. Choose one of your PVs and change its reclaim policy:

    $ oc patch pv <your-pv-name> -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}'
  3. Verify that your chosen PV has the right policy:

    $ oc get pv
    Example Output
    NAME                                       CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS    CLAIM             STORAGECLASS     REASON    AGE
     pvc-b6efd8da-b7b5-11e6-9d58-0ed433a7dd94   4Gi        RWO           Delete          Bound     default/claim1    manual                     10s
     pvc-b95650f8-b7b5-11e6-9d58-0ed433a7dd94   4Gi        RWO           Delete          Bound     default/claim2    manual                     6s
     pvc-bb3ca71d-b7b5-11e6-9d58-0ed433a7dd94   4Gi        RWO           Retain          Bound     default/claim3    manual                     3s

    In the preceding output, the PV bound to claim default/claim3 now has a Retain reclaim policy. The PV will not be automatically deleted when a user deletes claim default/claim3.

Persistent volumes

Each PV contains a spec and status, which is the specification and status of the volume, for example:

PV object definition example
  apiVersion: v1
  kind: PersistentVolume
    name: pv0003
      storage: 5Gi
      - ReadWriteOnce
    persistentVolumeReclaimPolicy: Retain
      path: /tmp
  • NFS

  • HostPath

  • GlusterFS

  • OpenShift Container Storage (OCS) File

  • OpenShift Container Storage (OCS) Block

  • Ceph RBD

  • OpenStack Cinder

  • AWS Elastic Block Store (EBS)

  • GCE Persistent Disk

  • iSCSI

  • Fibre Channel

  • Azure Disk

  • Azure File

  • VMWare vSphere

  • Local


Generally, a PV has a specific storage capacity. This is set by using the PV’s capacity attribute.

Currently, storage capacity is the only resource that can be set or requested. Future attributes may include IOPS, throughput, and so on.

Access modes

A PersistentVolume can be mounted on a host in any way supported by the resource provider. Providers will have different capabilities and each PV’s access modes are set to the specific modes supported by that particular volume. For example, NFS can support multiple read/write clients, but a specific NFS PV might be exported on the server as read-only. Each PV gets its own set of access modes describing that specific PV’s capabilities.

Claims are matched to volumes with similar access modes. The only two matching criteria are access modes and size. A claim’s access modes represent a request. Therefore, you might be granted more, but never less. For example, if a claim requests RWO, but the only volume available is an NFS PV (RWO+ROX+RWX), the claim would then match NFS because it supports RWO.

Direct matches are always attempted first. The volume’s modes must match or contain more modes than you requested. The size must be greater than or equal to what is expected. If two types of volumes (NFS and iSCSI, for example) have the same set of access modes, either of them can match a claim with those modes. There is no ordering between types of volumes and no way to choose one type over another.

All volumes with the same modes are grouped, and then sorted by size (smallest to largest). The binder gets the group with matching modes and iterates over each (in size order) until one size matches.

The following table lists the access modes:

Table 1. Access modes
Access Mode CLI abbreviation Description



The volume can be mounted as read-write by a single node.



The volume can be mounted read-only by many nodes.



The volume can be mounted as read-write by many nodes.

A volume’s AccessModes are descriptors of the volume’s capabilities. They are not enforced constraints. The storage provider is responsible for runtime errors resulting from invalid use of the resource.

For example, Ceph offers ReadWriteOnce access mode. You must mark the claims as read-only if you want to use the volume’s ROX capability. Errors in the provider show up at runtime as mount errors.

The following table lists the access modes supported by different PVs:

Table 2. Supported access modes for PVs
Volume Plug-in ReadWriteOnce ReadOnlyMany ReadWriteMany




Azure File

Azure Disk



Ceph RBD


Fibre Channel


GCE Persistent Disk













Openstack Cinder



VMWare vSphere






Use a recreate deployment strategy for pods that rely on AWS EBS, GCE Persistent Disks, or Openstack Cinder PVs.


The following restrictions apply when using persistent volumes with OpenShift Dedicated:

  • Persistent volumes are provisioned with EBS volumes (AWS).

  • Only RWO access mode is applicable, as EBS volumes cannot be mounted to multiple nodes.

  • emptyDir has the same lifecycle as the pod:

    • emptyDir volumes survive container crashes/restarts.

    • emptyDir volumes are deleted when the pod is deleted.

Reclaim policy

The following table lists current reclaim policies:

Table 3. Current reclaim policies
Reclaim policy Description


Allows manual reclamation.


Deletes both PV and associated external storage asset.

If you do not want to retain all pods, use dynamic provisioning.


Volumes can be found in one of the following phases:

Table 4. Volume phases
Phase Description


A free resource not yet bound to a claim.


The volume is bound to a claim.


The claim was deleted, but the resource is not yet reclaimed by the cluster.


The volume has failed its automatic reclamation.

The CLI shows the name of the PVC bound to the PV.

Persistent volume claims

Each PVC contains a spec and status, which is the specification and status of the claim, for example:

PVC object definition example
kind: PersistentVolumeClaim
apiVersion: v1
  name: myclaim
    - ReadWriteOnce
      storage: 8Gi
  storageClassName: gold

Storage classes

Claims can optionally request a specific storage class by specifying the storage class’s name in the storageClassName attribute. Only PVs of the requested class, ones with the same storageClassName as the PVC, can be bound to the PVC. The cluster administrator can configure dynamic provisioners to service one or more storage classes. The cluster administrator can create a PV on demand that matches the specifications in the PVC.

The cluster administrator can also set a default storage class for all PVCs. When a default storage class is configured, the PVC must explicitly ask for StorageClass or storageClassName annotations set to "" to be bound to a PV without a storage class.

Access modes

Claims use the same conventions as volumes when requesting storage with specific access modes.


Claims, such as pods, can request specific quantities of a resource. In this case, the request is for storage. The same resource model applies to volumes and claims.

Claims as volumes

Pods access storage by using the claim as a volume. Claims must exist in the same namespace as the pod by using the claim. The cluster finds the claim in the pod’s namespace and uses it to get the PersistentVolume backing the claim. The volume is mounted to the host and into the pod, for example:

Mount volume to the host and into the pod example
kind: Pod
apiVersion: v1
  name: mypod
    - name: myfrontend
      image: dockerfile/nginx
      - mountPath: "/var/www/html"
        name: mypd
    - name: mypd
        claimName: myclaim

Multi-AZ persistent volume claims

A walkthrough of common use cases for persistent volumes on a Multi-AZ OpenShift Dedicated cluster.

Configuration details

A multi-AZ OpenShift Dedicated cluster comes configured with one storage class per availability zone where the cluster is provisioned. One of these storage classes is set as the default. For example, a cluster provisioned in us-east-2 would have three storage classes that are named to indicate their availability zone.

Table 5. StorageClass availability zone
StorageClass Name Provisioner Age

gp2-encrypted-us-east-2a (default)









Use cases

Creating a PersistentVolumeClaim with a specific storage class (CLI)

Creating a PersistentVolumeClaim (PVC) via the CLI requires a manifest file that provides the name and details of the PersistentVolume (PV) being requested. To have the PVC use a different storage class, simply indicate that in your manifest.

PVC example
apiVersion: v1
kind: PersistentVolumeClaim
  name: mypvc
  - ReadWriteOnce
    storage: 1Gi
  storageClassName: gp2-encrypted-us-east-2b (1)
1 Specify your storage class to override the default.

Passing this manifest to oc create -f <manifest filename> creates a PV in the AZ of the storage class provided. You can confirm this by checking the output of oc get pvc.

Creating a PersistentVolumeClaim with a specific storage class (UI)

To choose a storage class for your PVC using the web console, navigate to the Storage dashboard and click the "Create Storage" button. The first option on the "Create Storage" page is a dropdown list of available storage classes.

Create storage with UI
Figure 1. Storage Class dropdown

The drop-down menu shows the name, zone, and access mode for the available storage classes. You can select your desired storage class, provide a name and size for the PVC, and click Create.

Using non-default storage classes with OpenShift templates (CLI only)

OpenShift Dedicated ships with a number of templates that can be used to quickly deploy popular applications and frameworks. These are listed in the catalog when using the web console and are viewable from CLI by viewing the output of:

$ oc get templates -n openshift

Some of these templates include PVC definitions to provide persistent storage, but they do not natively support selection of a non-default storage class. However, there are plans to support this in the future. To use a template with a specific storage class, you need to copy the template to disk and edit it prior to using it. For example, if you want to use the MongoDB template with a PVC in us-east-2b:

  1. Copy the template to a file:

    $ oc get template -n openshift mongodb-persistent -o yaml --export > mongodb-persistent.yml
  2. Look through the file for any PersistentVolumeClaim definitions and edit them to include an option to specify the storage class. The MongoDB template has one PVC defined. The line highlighted below shows what needs to be added to allow specification of a non-default storage class

    apiVersion: v1
    kind: PersistentVolumeClaim
      - ReadWriteOnce
          storage: ${VOLUME_CAPACITY}
      storageClassName: ${STORAGE_CLASS_NAME}
  3. At the bottom of the template file, add the new parameter STORAGE_CLASS_NAME to the parameter list

    description: Storage class to use for persistent storage
    displayName: Storage class name
    required: true

Now that you have an updated template, you can use it from the CLI or web console. From the CLI, you can pass in the required parameters to oc process and create them.

$ oc process -f mongodb-export.yml \
STORAGE_CLASS_NAME=gp2-encrypted-us-east-2b | oc create -f

Alternatively, you can upload your template via the web console and fill out the parameters of the template interactively. To do so, select Import YAML / JSON from the Add to Project drop-down menu in the application console.

Import yaml/json to project
Figure 2. Import yaml/json to project

Now, you can either upload your template file or copy and paste it into the provided text field and then click Create. Now, you can opt to process and/or save your template file to the selected namespace for future use. If you process the template, you are directed to a page to fill out the available template parameters, including the desired storage class. After populating the parameters, you can create the MongoDB service and confirm that your PVC has been created in the correct AZ.

Best practices

It is very important to deliberately select a storage class when provisioning PVCs in a multi-AZ OpenShift Dedicated cluster. If every PVC is always provisioned by the default storage class, this can lead to problems in the future.

One of these problems is an uneven distribution of workload. If you are primarily running workloads that make use of persistent storage, and you always provision that storage using the default storage class, all of your pods will be scheduled to nodes in that AZ. This can lead to a situation where the nodes in one AZ are running out of capacity while the rest of the cluster is underutilized. Once you are in this state, there is not an easy method to redistribute the workloads. Any redistribution will require backing up and restoring the contents of PVs manually. The other problem with this state is that it effectively undermines the point of a multi-AZ cluster in the first place. If your default storage class' AZ fails, a significant amount of your workload could be lost with it.