PVC Access Modes

Difficulty: Intermediate

Question

What are the access modes for a PersistentVolumeClaim in Kubernetes, and how do you choose between them?

Answer

Access modes describe how a volume can be mounted by nodes and Pods. The three classic ones are ReadWriteOnce (RWO, read-write by a single node), ReadOnlyMany (ROX, read-only by many nodes) and ReadWriteMany (RWX, read-write by many nodes). A fourth mode, ReadWriteOncePod (RWOP), stable since Kubernetes 1.29, restricts the volume to a single Pod in the whole cluster.

What each mode really means

ModeShort formWho can mount itTypical backends
ReadWriteOnceRWORead-write by one node (any number of Pods on that node)AWS EBS, GCE Persistent Disk, Azure Disk, local volumes
ReadOnlyManyROXRead-only by many nodesGCE PD in read-only mode, NFS, pre-populated datasets
ReadWriteManyRWXRead-write by many nodesAWS EFS, Azure Files, Filestore, NFS, CephFS
ReadWriteOncePodRWOPRead-write by exactly one PodCSI drivers that support it

The most misunderstood point: RWO is per node, not per Pod. Two Pods scheduled on the same node can both mount an RWO volume. If you need a hard guarantee that only one Pod writes, use RWOP.

How access modes affect binding and scheduling

  • A PVC only binds to a PersistentVolume (or a dynamically provisioned one) whose access modes include the requested mode.
  • The storage driver decides what is actually possible. Block storage like EBS physically attaches to one instance, so it can only offer RWO. Asking for RWX on an EBS StorageClass leaves the PVC Pending.
  • Access modes are mostly a capability declaration. Kubernetes does not make an RWX volume read-only for some Pods; use readOnly: true on the volume mount for that.

Common real-world mistakes

  • Deployment with replicas > 1 on an RWO volume: the second replica lands on another node and fails with a Multi-Attach error for volume. Use a StatefulSet with volumeClaimTemplates so each replica gets its own volume.
  • Rolling updates with RWO: the new Pod may be scheduled on another node while the old one still holds the disk. Use strategy: Recreate for single-replica stateful Deployments.
  • Reaching for RWX by default: network filesystems like EFS are slower and have different consistency and locking behaviour than block disks. Databases should use RWO block storage, not NFS.

How to choose

  • Database, message broker, single-writer app: RWO (or RWOP if you want strictness), one volume per replica via a StatefulSet.
  • Shared uploads or CMS media written by many web Pods: RWX, or better, object storage like S3 accessed through the app.
  • Read-only reference data or ML models shared by many Pods: ROX, or bake the data into the image if it is small.

For example, a Razorpay-style ledger database runs as a StatefulSet with RWO SSD volumes per replica, while a shared invoice-template folder used by many rendering Pods could sit on an RWX file share.

RWO vs RWX vs RWOP at a glance. Access modes are about how many nodes or Pods can mount a volume for writing.
RWORWXRWOP
Writers allowedPods on one nodePods on many nodesExactly one Pod
Typical storageBlock disk like EBSFile share like EFS or NFSCSI block or file volume
Best forDatabases per replicaShared filesStrict single writer
Common failureMulti-Attach error across nodesSlower IO, locking issuesSecond Pod stays Pending

Code examples

PVCs with different access modes

# Block storage for a single-writer database
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ledger-db-data
spec:
  accessModes: ["ReadWriteOncePod"]   # only one Pod may use it
  storageClassName: gp3
  resources:
    requests:
      storage: 100Gi
---
# Shared file storage for many web Pods
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: shared-uploads
spec:
  accessModes: ["ReadWriteMany"]
  storageClassName: efs-sc            # backed by a network filesystem
  resources:
    requests:
      storage: 50Gi

The access mode must be supported by the StorageClass's driver. Requesting RWX on a block-storage class like gp3 would leave the claim Pending.

Key points

  • RWO = one node read-write, RWX = many nodes read-write, ROX = many nodes read-only.
  • RWOP (ReadWriteOncePod) restricts a volume to one Pod; stable since 1.29, CSI only.
  • RWO is per node, so multiple Pods on the same node can share it.
  • Block storage (EBS, Azure Disk) is RWO; file storage (EFS, NFS, Azure Files) supports RWX.
  • Deployments with RWO volumes and multiple replicas hit Multi-Attach errors; use StatefulSets.

Common follow-up questions

  • Why can't an EBS volume be ReadWriteMany?
  • What is the difference between a PV, a PVC and a StorageClass?
  • How do StatefulSet volumeClaimTemplates work with access modes?
  • What does `volumeBindingMode: WaitForFirstConsumer` solve?

Interview tips

  • Mention ReadWriteOncePod; most candidates only list three modes.
  • Point out that RWO is per node, not per Pod. That nuance stands out.
  • Connect access modes to the storage backend, since the driver decides what is possible.

Concepts covered

ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod, StorageClass

More Kubernetes & Orchestration questions