ReadWriteOnce permits a volume to be mounted read-write by one node; it does not, by itself, prohibit two Pods on that same node from writing through the mount. ReadWriteOncePod is the access mode intended to restrict a compatible CSI volume to one Pod at a time. This is a scheduling and mount contract, not a distributed database lease or a guarantee against a process that still holds access outside the cluster.
ReadWriteOncePod: enforce one Kubernetes writer for one claim
Operational decision
A receipt ledger keeps one writable segment on a persistent claim. Verify that the cluster version and CSI provisioner, attacher, and resizer support the Pod-level mode before changing a live claim. Create a disposable claim with the fragment below and schedule one writer. Attempt a second writer on the same node; it should wait rather than opening the same files. Then kill the first Pod during a simulated commit and inspect application recovery before permitting the replacement. Record the old writer's termination, volume unmount, and new writer's first successful transaction. A forced node loss can leave uncertainty about the prior process, so pair the mount rule with the ledger's own fencing or transaction recovery. Change an existing volume's access mode only through a supported migration procedure and a tested backup, not by assuming a claim edit will rewrite every bound resource safely.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: receipt-ledger-writer
namespace: checkout
spec:
accessModes:
- ReadWriteOncePod
storageClassName: receipt-csi-retain
resources:
requests:
storage: 47GiCost and verification
Single-Pod enforcement can lengthen failover because the old mount must be released before the replacement starts. The extra waiting is preferable to concurrent corruption for a single-writer store, but it affects recovery objectives. Measure time from old-Pod failure to new-Pod write acceptance, mount conflict events, and incomplete transactions. The requested 47 GiB is capacity planning input, not a guarantee that the application can safely fill every byte; leave filesystem and recovery headroom.
Common Mistakes
- Do not treat ReadWriteOnce as a one-Pod writer fence.
- Do not assume every CSI driver supports ReadWriteOncePod.
- Do not omit application-level recovery after the prior writer disappears.
Connected lessons
- DevOps: delivery, infrastructure, and reliable operations
- Persistent storage: PVC lifecycle and data ownership
- Failover fencing: prevent two writable database leaders
- StatefulSet rollout safety: preserve identity and data while updating
- CSI attach limits: verify storage placement as well as CPU placement
