Kubernetes shared persistent volume between multiple nodes

6/12/2019

I am currently looking into setting up Kubernetes pods for a project on GCP.

The problem - I need to set a persistent shared volume which will be used by multiple nodes. I need all nodes to be able to read from the volume and only one node must be able to write on the volume. So I need some advice what's the best way to achieve that?

I have checked the Kubernetes documentation and know that GCEPersistentDisks does not support ReadWriteMany but anyway this access mode I think will be an overkill. Regarding the ReadOnlyMany I get that nodes can read from the PV but I don't understand how or what can actually modify the PV in this case. Currently my best bet is setting up NFS with GCE persistent disk.

Also the solution should be able to run on the cloud or on premise. Any advice will be appreciated :)

-- Svetoslav Petrov
google-cloud-platform
kubernetes
persistent-storage

1 Answer

7/4/2019

According to official documentation:

A PVC to PV binding is a one-to-one mapping.

A volume can only be mounted using one access mode at a time, even if it supports many. For example, a GCEPersistentDisk can be mounted as ReadWriteOnce by a single node or ReadOnlyMany by many nodes, but not at the same time.

So I am afraid that this would be impossible to do it how you described.

However, you may want to try task queue

Please let me know if that helped.

-- OhHiMark
Source: StackOverflow