In my kubernetes cluster, there are two nodes. Within this cluster, I have a PV with the following configuration.
kind: PersistentVolume
metadata:
name: mypv
spec:
storageClassName: standard
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
nfs:
path: <file_path>
server: <server_ip>
In this case, the access mode is RWO. However, pods from different nodes can successfully write onto the pv. But it should fail as per the access mode.
No. When you're using an NFS server as a Persistent Volume (PV) in a Kubernetes cluster, the access modes are determined by the underlying storage system (in this case, NFS) rather than the access modes specified in the Persistent Volume itself.
The access modes you set (like ReadWriteOnce) don't work as strictly as they do with local storage. NFS, being a shared file system, allows multiple nodes to read and write, regardless of specified access modes. It doesn't enforce the access modes in the same way as local storage.
Access modes like ReadWriteMany and ReadOnlyMany are more common because NFS is inherently a shared file system. So, even if you set it as ReadWriteOnce, pods from different nodes can still write to it.