Persistent Volumes use the
accesModes array to ensure that the resulting volume mounts in a way supported by the resource provider’s filesystem.
There are three access modes supported by Kubernetes:
- ReadWriteOnce (RWO) – A single node may mount the volume with read-write permissions
- ReadOnlyMany (ROX) – Many nodes may mount the volume with read-only permissions
- ReadWriteMany (RWX) – Many nodes may mount the volume with read-write permissions
Below is an example of a PersistentVolume that allows ReadWriteOnce and ReadOnlyMany access modes
apiVersion: v1 kind: PersistentVolume metadata: name: app-pv spec: capacity: storage: 50Gi accessModes: - ReadWriteOnce - ReadOnlyMany persistentVolumeReclaimPolicy: Retain hostPath: path: "/app/logs"