multiple persistent volume claims on the same persistent volume

12/13/2021

I am working with kubernetes for a long time and I have a question that I am not sure what the answer is.

If I create a PersistentVolume and couple of PersistentVolumeClaims that uses that PersistentVolume. I mapped different PersistentVolumeClaims to different pods/containers.

Is There a way that one pod could read data that the other pod/container written?

-- DaniDin
kubernetes
persistent-volumes

1 Answer

12/13/2021

TL;DR: By mistake - no. By a chain of mistakes - yes.

First, PV Access Mode need to be set to ReadWriteMany.

Then, a specific Volume Plugin have to be used. While Kuberentes supports a lot of different volumes, only few support ReadWriteMany Access Mode.
Those volume types that do support ReadWriteMany can be found in this table (scroll down a bit).

As far as a container is concerned, PersistentVolume is just a volume mounted in container's filesystem. If you mount it to multiple pods, they will be able to read and write to the same files.

-- p10l
Source: StackOverflow