liveBook · Manning

ReadWriteOncePod

As explained in Kubernetes in Action, Second Edition

ReadWriteOncePod is a Kubernetes volume access mode that permits a volume to be mounted read-write by only one pod at a time.

ReadWriteOncePod (RWOP) is a Kubernetes volume access mode that permits one pod across the entire cluster to mount a volume for reading and writing. A PersistentVolumeClaim requests this mode when only one pod instance should use the volume at a time. section 10.2.4 section 10.2.1

Use RWOP to establish an exclusive pod-level storage relationship:

  • The volume attaches to one node and mounts into one pod, which can both read and write its files. section 10.2.4
  • A second pod using the same PersistentVolumeClaim remains Pending because simultaneous use is forbidden. section 10.2.4
  • Do not confuse RWOP with ReadWriteOnce: ReadWriteOnce permits multiple pods on the same node, while RWOP permits only one pod cluster-wide. section 10.2.4 section 10.2.1

Requesting exclusive access for a quiz database

A claim can request RWOP with `accessModes: [ReadWriteOncePod]` and `storage: 1Gi`. A quiz pod then mounts the claim into its MongoDB container. After binding, `kubectl get pvc quiz-data` reports access mode `RWOP`; deleting the pod leaves the claim available for reuse in another pod. section 10.2.1 section 10.2.2

$ kubectl get pods
NAME    READY   STATUS    RESTARTS   AGE
quiz    2/2     Running   0          20m
quiz2   0/2     Pending   0          12m

Inspect the expected Pending status when a second pod attempts to use the same RWOP claim. section 10.2.4

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines cluster-wide pod exclusivity, demonstrates Pending scheduling, and contrasts node-level ReadWriteOnce without discussing storage-driver internals.
Examples
Uses a quiz database claim, a MongoDB-mounted pod, and a second pod that remains Pending.
What it assumes
Assumes basic pods and PersistentVolumeClaims while defining access modes and showing how a claim mounts into a pod.
What you can do after
Apply it via kubectl and a PersistentVolumeClaim manifest, then verify RWOP binding and diagnose competing pods through status or events.
How it connects
Connects PersistentVolumeClaim, PersistentVolume, StorageClass, pod scheduling, and ReadWriteOnce.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.