OpenShift
persistent volume claim
PVC modes
Kubernetes storage
cloud computing

Understanding persistent volume claim modes in openshift

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

In OpenShift, a PersistentVolumeClaim does not just request storage size. It also requests an access mode, which tells Kubernetes how the workload expects to mount that volume. Choosing the right mode matters because not every storage backend supports every access pattern, and the mode describes node- or pod-level mounting behavior, not vague notions of "shared" or "private" storage.

Persistent Volumes, Claims, and Access Modes

A PersistentVolume is the actual storage resource. A PersistentVolumeClaim is the workload's request for storage. The access mode on the claim tells the cluster what kind of mount behavior is needed.

The classic access modes are:

  • 'ReadWriteOnce or RWO'
  • 'ReadOnlyMany or ROX'
  • 'ReadWriteMany or RWX'

In newer Kubernetes environments you may also encounter ReadWriteOncePod or RWOP, which is stricter than RWO, but the traditional three are still the ones most people learn first.

ReadWriteOnce

ReadWriteOnce means the volume can be mounted read-write by a single node at a time.

That is an important nuance: it is about node-level attachment, not strictly "one pod only." Multiple pods on the same node may be able to use the volume depending on the controller and storage behavior, but the volume is not meant for read-write mounting from multiple different nodes simultaneously.

A simple PVC example:

yaml
1apiVersion: v1
2kind: PersistentVolumeClaim
3metadata:
4  name: app-data
5spec:
6  accessModes:
7    - ReadWriteOnce
8  resources:
9    requests:
10      storage: 10Gi

This is common for databases or single-replica stateful workloads.

ReadOnlyMany

ReadOnlyMany allows the volume to be mounted read-only by many nodes.

This mode is useful when multiple workloads need to consume the same data but must not modify it. Typical examples include shared reference data, static assets, or prebuilt model files.

yaml
1spec:
2  accessModes:
3    - ReadOnlyMany
4  resources:
5    requests:
6      storage: 5Gi

Whether this is actually available depends on the storage class and backend. The claim can request it, but the platform still needs a compatible volume provider.

ReadWriteMany

ReadWriteMany allows read-write access from many nodes at the same time.

This is the classic choice for genuinely shared writable storage, such as:

  • shared content repositories
  • multiple application replicas writing to the same file tree
  • certain legacy applications expecting shared POSIX-style storage
yaml
1spec:
2  accessModes:
3    - ReadWriteMany
4  resources:
5    requests:
6      storage: 20Gi

Not every storage backend supports RWX. Block-oriented cloud volumes commonly support RWO, while network file systems are more likely to provide RWX.

OpenShift-Specific Practical Meaning

In OpenShift, the access mode request must still match what the storage class can provision. If you request RWX from a backend that only supports RWO, the claim will stay pending instead of binding successfully.

That is why PVC design is never just about YAML syntax. It is also about the storage backend behind the cluster.

A useful inspection command is:

bash
oc get pvc
oc describe pvc app-data

If a claim will not bind, the description often shows that the requested mode is unsupported by the available provisioner.

Access Mode Does Not Define Application Safety

A common misunderstanding is thinking that RWX automatically makes any application safe for concurrent shared writes. It does not. It only means the storage can be mounted that way.

Your application still needs to handle concurrent access correctly. Some applications work fine with shared writable storage; others corrupt data unless one writer is enforced.

So access mode is a storage capability, not a concurrency guarantee.

Choosing the Right Mode

Use RWO when one node at a time should own the writable volume.

Use ROX when many nodes need read-only access to the same data.

Use RWX when many nodes need shared writable storage and the backend supports it.

If your platform supports ReadWriteOncePod, use it when you want an even stricter single-pod writable guarantee.

Common Pitfalls

The most common mistake is reading ReadWriteOnce as "exactly one pod ever." The more accurate meaning is one node with read-write attachment.

Another mistake is requesting RWX without checking whether the storage class actually supports shared writable access.

Developers also often assume that if a PVC binds successfully, the application is automatically safe for concurrent writers. That is an application-level concern, not just a storage-level one.

Finally, do not ignore pending claims. A PVC that will not bind is often telling you the requested mode and the available storage backend do not match.

Summary

  • PVC access modes describe how a volume may be mounted, not how your application behaves internally.
  • 'RWO means read-write from a single node at a time.'
  • 'ROX means read-only from many nodes.'
  • 'RWX means read-write from many nodes, if the backend supports it.'
  • In OpenShift, the claim must match the capabilities of the storage class and provisioner.

Course illustration
Course illustration

All Rights Reserved.