Storage access modes¶
Storage access modes are specific settings within Kubernetes [[PersistentVolume|PersistentVolumes]] (PV) and [[PersistentVolumeClaim|PersistentVolumeClaims]] (PVC) that define how a storage volume can be mounted and accessed by nodes or pods^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. These modes determine the read/write capabilities and the scope of access (single node vs. multiple nodes) for the underlying storage resource^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Access Modes¶
Kubernetes supports the following access modes^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]:
- ReadWriteOnce (RWO): The volume can be mounted as read-write by a single node^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- This mode also allows multiple Pods running on the same node to access the volume^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- ReadOnlyMany (ROX): The volume can be mounted as read-only by many nodes^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- ReadWriteMany (RWX): The volume can be mounted as read-write by many nodes^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- ReadWriteOncePod (RWOP): The volume can be mounted as read-write by a single Pod^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- This mode ensures that only one Pod within the entire cluster can read from or write to the PVC, providing stricter isolation than
ReadWriteOnce^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
- This mode ensures that only one Pod within the entire cluster can read from or write to the PVC, providing stricter isolation than
Usage in Multi-Node Environments¶
The choice of access mode is particularly critical in multi-node production environments^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. Because the Kubernetes scheduler may distribute Pods for the same service across different nodes, explicit configuration is required to share resources between nodes^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
To access shared resources across different nodes, a PVC must specify ReadOnlyMany or ReadWriteMany^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md]. However, support for these modes is dependent on the underlying storage provisioner; options supporting multi-node write access (RWX) are often limited compared to those supporting single-node access^[400-devops__06-Kubernetes__k8s-ithelp__Day20__README.md].
Related Concepts¶
- [[PersistentVolume]]
- StorageClass
- [[StatefulSet]]