Configuring PVC for one writer and multiple readers

9/10/2020

I have 2 microservices, one preparing a file and another reading it to handle HTTP requests. So I'm going to create a PVC and two deployments, one for each microservice. The deployment for the "writing" microservice will consist of a single pod, another deployment will be horizontally scalable. There are 3 access modes, but none of them seems to fit my needs perfectly, and the docs are not clear to me. So which PVC access mode should I choose? It's very desirable to be able to keep those pods on different nodes.

-- skozlov
kubernetes
kubernetes-pvc

2 Answers

9/10/2020

create 2 separate pvc with your desired access modes for the same pv and attach to pods based on their usage. e.g write many can be used for writing and readonly many can be used for the RO purpose. No pod will be able to access the volume unless the pvc is there.

-- Muhammad Hasan
Source: StackOverflow

9/10/2020

You need storage backend that supports ReadWriteMany access modes and then set appropriate access mode for each deployment at the claim level (for pod that generates a file you would use ReadWriteOnce and for the second deployment you would use ReadOnlyMany mode).

So in order this to work you will have to use nfs, cephfs or other plugin that support ReadWriteMany. More detailed plugin list can be found here.

-- acid_fuji
Source: StackOverflow