How to share volume of my google cloud instance with the kubernetes cluster

8/17/2018

I am working on a design where I will have my git repository located at one of the google cloud instance. I am trying to run my tests in parallel using kubernetes cluster. However I am not able to share the Standard persistent disk(which is having the github repository) that is configured to my instance with the kubernetes cluster. I need my containers to work on the repository that is located in the instance and don't want to create copies of it in cluster instances.

I have achieved the same thing using docker on a vm but now I would like to put everything on the cloud and run it in a containerised environment.

-- djey
docker
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

8/17/2018

You need to create a persistant volume and then mount that pv to the kubernetes pod.

You should note that this will be read only as you cant attach multiple containers to write to a persistent disk - if you want RW then you will need to use NFS/Gluster or more sensibly GCR.

-- Dan
Source: StackOverflow