Access Modes and Volume Modes

In Kubernetes, PersistentVolumeClaims (PVCs) and StorageClasses work together to manage how storage is provisioned and accessed by workloads. Two essential concepts in this domain are Access Modes and Volume Modes. This article explores these concepts and highlights how different storage systems support them.

Access Modes in Kubernetes

Access Modes define how a volume can be mounted and used by pods. The key access modes are:

  • ReadWriteOnce (RWO): The volume can be mounted as read-write by a single node.
  • ReadOnlyMany (ROX): The volume can be mounted as read-only by multiple nodes.
  • ReadWriteMany (RWX): The volume can be mounted as read-write by multiple nodes.

Access Modes by Storage Class

Storage ClassRWO SupportedROX SupportedRWX Supported
CephFS File StorageYesNoYes
CephRBD Block StorageYesNoNo
TopoLVMYesNoNo
NFS Shared StorageYesNoYes

As shown above, file-based storage systems like CephFS and NFS support multiple concurrent write or read operations, making them suitable for shared-access scenarios. On the other hand, block storage systems like CephRBD and TopoLVM provide exclusive access to a single node at a time.

Volume Modes in Kubernetes

Volume Modes define how the data is exposed to the pod:

  • Filesystem: The volume is mounted into the pod as a filesystem.
  • Block: The volume is presented as a raw block device.

Volume Modes by Storage Class

Storage ClassTypeSupported Volume Modes
CephFS File StorageFile StorageFilesystem
CephRBD Block StorageBlock StorageFilesystem, Block
TopoLVMBlock StorageFilesystem, Block
NFS Shared StorageFile StorageFilesystem

Block storage systems like CephRBD and TopoLVM offer both filesystem and raw block access, providing flexibility for different application needs. File storage systems such as CephFS and NFS, in contrast, only support the filesystem mode.

Storage Features: Snapshots and Expansion

Kubernetes also supports advanced features like volume snapshots and dynamic expansion of PVCs, depending on the storage class used.

Storage ClassVolume SnapshotExpansion
CephFS File StorageSupportedSupported
CephRBD Block StorageSupportedSupported
TopoLVMSupportedSupported
NFS Shared StorageNot SupportedNot Supported

Only dynamically provisioned PVCs using a StorageClass support volume snapshots. This feature is useful for backups and cloning environments.

Conclusion

When configuring storage in Kubernetes, understanding the Access Modes and Volume Modes of PVCs and their backing StorageClasses is critical for choosing the right solution for your workload. File storage solutions such as CephFS and NFS are ideal for shared access scenarios, while block storage like CephRBD and TopoLVM excel in high-performance, single-node deployments. Furthermore, support for features like snapshots and expansion can greatly enhance storage flexibility and data management strategies.