Understanding persistent volume claim modes in openshift

2/14/2018

I am trying to understand different access modes for Persistent Volume Claims in Openshift. Found the following information from here

Access Mode         CLI Abbreviation             Description
ReadWriteOnce           RWO               The volume can be mounted as read-write by a single node.

ReadOnlyMany            ROX               The volume can be mounted read-only by many nodes.

ReadWriteMany           RWX               The volume can be mounted as read-write by many nodes.

I know that PVC are bound to single project/namespace and can be extended to different projects as well.

But the confusion here is, what does "single node" or "many nodes" mean here. For example, in RWO mode, "The volume can be mounted as read-write by a single node". What node it is referring to.

Can someone give me the significance of these modes with respect to single project/namespace. Does the storage with RWO can have write permission for only one application or all the applications within the project?

-- Here_2_learn
kubernetes
openshift
openshift-enterprise

1 Answer

2/14/2018

The whole RWO vs RWX concept is related to the issue of mounting the same filesystem on multiple hosts, which requires support for things like ie. distributed locking. There are specific implementations that can handle this like ie. NFS, Ceph, GlusterFS etc. generally network/cluster oriented filesystems. Other filesystems are unable to operate correctly if you try to mount them on different servers at the same time (usually they will just not allow this).

So, node, in this case, means particular kubernetes cluster node (be it baremetal server or vm). But, by extension, you should think about it in scope of POD as well, cause in most cases pods can spin up on different nodes, meaning they could not use the same volume or you can not assume that this volume will have coherent shared state, as would happen ie. using HostPath volumes that are unique per every node in cluster.

To clarify for the question below :

RWO volumes have 1:1 relation to pod in general. While in some cases you can define RWO volumes to point to the same physical resource like hostPath, technically they will always be tightly coupled to exclusively one POD. This is specially visible if you use PhysicalVolumes / PhysicalVolumeClaims objects, which will take into account these restrictions for binding PV to PVC. Only RWX volumes give you a storage shared by multiple pods with all pods being able to write to it.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow