How pods are able to mount the same pvc with ReadWriteOnce access mode when storageClass is with glusterfs but not with cinder default storage?

6/14/2019

Want to understand how pod1 claimed PVC with accessMode: ReadWriteOnce is able to share with pod2 when storageclass glusterfs is created?Shouldn't it fail as I need to specify the accessMode as ReadWriteMany?

-> Created storageclass as glusterfs with type:distributed

-> PV created on top of the storageclass above and pvc is done with AccessMode: ReadWriteOnce

-> First Pod attached the above PVC created

-> Second Pod trying to attach the same PVC created and it does work and able to access the files which first pod created

Tried another flow without a storageclass and directly creating PVC from the cinder storage and the below error shows up,

Warning FailedAttachVolume 28s attachdetach-controller Multi-Attach error for volume "pvc-644f3e7e-8e65-11e9-a43e-fa163e933531" Volume is already used by pod(s) pod1

Trying to understand why this is not happening when the storageclass is created and assigned to PV?

How I am able to access the files from the second pod when the AccessMode: ReadWriteOnce? According to k8s documentation if multiple pods in different nodes need to access it should be ReadWriteMany.

If RWO access mode works then is it safe for both the pods to read and write? Will there be any issues? What is the role of RWX if RWO works just fine in this case?

Would be great if some experts can give an insight into this. Thanks.

-- Melwyn Jensen
kubernetes
kubernetes-pod
kubernetes-pvc

1 Answer

6/14/2019

Volumes are RWO per node, not per Pod. Volumes are mounted to the node and then bind mounted to containers. As long as pods are scheduled to the same node, RWO volume can be bind mounted to both containers at the same time.

-- Tuminoid
Source: StackOverflow