Skip to content

Kubernetes Storage Access Modes

Kubernetes Storage Access Modes define how a storage volume can be mounted and accessed by nodes and Pods within a cluster^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]. These modes are specified in the accessModes field of both Persistent Volumes (PV) and [[PersistentVolumeClaims]] (PVC)^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]. They act as constraints that the Kubernetes system uses to match a claim (PVC) with an appropriate persistent volume (PV)^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md].

Available Modes

Kubernetes supports the following specific 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 permits 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 across the entire cluster, only one specific Pod can read from or write to the storage^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md].

Considerations and Limitations

The selection of an access mode depends heavily on the underlying storage infrastructure and the cluster configuration^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md].

  • Single vs. Multi-Node Clusters: In single-node clusters (often used for local development, such as Docker Desktop), access modes like ReadWriteMany may appear to work effectively because all Pods reside on the same node^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]. However, in production environments that utilize multi-node clusters (e.g., Google GKE or AWS EKS), Pods may be distributed across different nodes^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md].
  • Provisioner Support: For Pods on different nodes to share resources successfully, the storage must support ReadOnlyMany or ReadWriteMany^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]. Support for these modes is relatively limited among storage provisioners, often relying on cloud-based NFS (Network File System) services to implement ReadWriteMany^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md].

Sources

^[400-devops-06-kubernetes-k8s-ithelp-day20-readme.md]

  • [[Kubernetes Volumes]]
  • PersistentVolumes
  • [[PersistentVolumeClaims]]
  • [[StorageClasses]]