<p>I've been developing an app on my local laptop (Mac) with Minikube. Instead of packaging the code and files into the docker image, I use <code>hostPath</code> and <code>volumeMount</code> that points to the code/file directory on my Mac, so that I can avoid rebuilding the image every time. </p>

<p>Now I would like to do the same iterative testing with google cloud. What's the best way to "mount" my local code/file directory and run pods remotely on the cloud? I don't want to package the code into a docker image, push to dockerhub, and then pull from dockerhub on gcloud. My dockerhub is a free account and would expose my code. </p>

<p><strong>You want:</strong> 
You want to mount your local file system into your remote Kubernetes cluster.</p>

<p><strong>Answer:</strong>
As far I know, you can't do this. Its possible in <code>minikube</code>, because, you can mount your local directory with <code>minikube</code>. </p>

<p><strong>Solution:</strong> 
I can tell you an alternative way. May be this is not what you want. But it can help you.</p>

<p>Do you use <code>git</code>? If your answer is yes and also if you have no problem to keep your files into git repository, following process will help you.</p>

<pre><code>spec:
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - mountPath: /mypath
      name: git-volume
  volumes:
  - name: git-volume
    gitRepo:
      repository: "git@somewhere:me/my-git-repository.git"
      revision: "22f1d8406d464b0c0874075539c1f2e96c253775"
</code></pre>

<p>When you will create this Pod, <code>my-git-repository</code> will be mounted into your directory <code>/mypath</code> inside your Pod container.</p>

<p>Basically, you can tell your Pod to pull this git from specific branch. So every time, you change your code, push it. Then create Pod again. </p>

<p>Read <a href="https://kubernetes.io/docs/concepts/storage/volumes/#gitrepo" rel="nofollow noreferrer">volumes/#gitrepo</a></p>
