PV Access Modes
What you'll learn: How Kubernetes PersistentVolumes control which pods can read and write storage, and when.
The Core Concept
When you create a PersistentVolume, you must specify an access mode that defines how many pods can mount the volume simultaneously and whether they can write to it. Think of it like a library book checkout system: some books can be borrowed by only one person at a time (exclusive), while reference materials can be read by many people simultaneously (shared).
Kubernetes offers three access modes:
ReadWriteOnce (RWO)
The volume can be mounted as read-write by a single node. Multiple pods on that same node can access it, but pods on other nodes cannot. This is the most common mode and works with most storage types. Perfect for databases or applications that need exclusive write access.
ReadOnlyMany (ROX)
The volume can be mounted as read-only by many nodes simultaneously. Ideal for distributing static content, configuration files, or shared datasets across multiple pods without modification risks.
ReadWriteMany (RWX)
The volume can be mounted as read-write by many nodes simultaneously. This requires special network-attached storage (like NFS or cloud file systems). Use this when multiple pods across different nodes need to collaborate on shared data, such as a content management system.
Choosing the Right Mode
Your choice depends on your workload and underlying storage capabilities. Not all storage providers support all modes—local disks typically only support RWO, while network file systems can support RWX.
Key Takeaway: Access modes define single vs. multi-node mounting and read-only vs. read-write permissions; choose based on your application's concurrency needs and storage backend capabilities.