Share data between pods in ReadMany mode and allow to write only for one host(WriteOnce)

1/18/2018

We've got to write files from one host in a shared storage and share these files between many pods in read only state. Like this:

writer -> shared storage <- pod_reader_nth

I tried to use Google Persistent Storage, but k8s doesn't allow to mix ReadMany and WriteOnce. Is there any way to solve this issue simple, like use some SaaS solution and don't use CephFS/GlusterFS/NFS?

inb4: Tried Google Cloud Storage buckets, but got degraded performance when wrote a lot of files.

-- Alexey Boyko
google-kubernetes-engine
kubernetes

1 Answer

6/29/2018

As you mentioned, you cannot use Google Persistent Storage as with the mixup of ReadMany and WriteOnce. Also, you cannot use as "ReadWriteMany" as mentioned in https://cloud.google.com/kubernetes-engine/docs/concepts/persistent-volumes

Other alternate way would be use "hostPath" - https://kubernetes.io/docs/concepts/storage/volumes , where you can mount a directory from the host node’s filesystem into your pod. You can mount the persistent disk to the cluster nodes. The problem here is all your pods gets write access to the hostPath. It will essentially become "ReadWriteMany".

-- Baskar
Source: StackOverflow