How to make all k8s nodes read/wrote from/to one shared storage on Google Compute Engine

5/6/2020

I have 20 VM Instance on GCE with kubernetes self install (using the following https://medium.com/edureka/install-kubernetes-on-ubuntu-5cd1f770c9e4).

I want all the pod was created on pods node read/write files from one shared storage.

Example:

pod1 on node1 write file to /some/shared/directory/pod1file.txt
pod12 on node12 read the file /some/shared/directory/pod1file.txt
...

How can I do it?

-- samisaviv
google-compute-engine
kubernetes

2 Answers

5/6/2020

First thing to do would be to go to kubernetes volumes docs, and see from the available storage options which supports shared volumes; like gluster or ceph.

As coderanger is mentioning, you can also use nfs, and go for Filestore. The drawback is the price here. Filestore is not cheap, to not say it is expensive. And the minimum storage to get is 1TB, I think, so if you need say 100GB storage, not possible. Now, that's the ONLY storage service you can use on GCP, as Managed Service.

If not Filestore you are left with creating your own gluster, for example, or any other shared storage on GCE, and mount it into your pods.

-- suren
Source: StackOverflow

5/6/2020

Google offers Cloud Filestore which is hosted NFS. You can then use that with your pods.

-- coderanger
Source: StackOverflow