<p>I am trying out to have a volume mount on Kubernetes.</p>
<p>Currently I have a Docker image which I run like:</p>
<pre><code>docker run --mount type=bind,source=&quot;$(pwd)&quot;&lt;host_dir&gt;,target=&lt;docker_dir&gt; container
</code></pre>
<p>To have this run on Google Kubernetes cluster, I have:</p>
<ol>
<li>Create a Google Compute Disk</li>
<li>Created a persistent volume which refers to the disk:</li>
</ol>
<pre><code>
kind: PersistentVolume
...
    namespace: default
    name: pvc
spec:
  claimRef:
    namespace: default
    name: pvc
  gcePersistentDisk:
    pdName: disk-name
    fsType: ext4
---
...
kind: PersistentVolumeClaim
metadata:
  name: pvc
spec:
  storageClassName: &quot;storage&quot;
...
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2000Gi
</code></pre>
<ol start="3">
<li>Created pod with mount</li>
</ol>
<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: k8s-pod
spec:
  volumes:
    - name: pvc
      persistentVolumeClaim:
       claimName: pvc
  containers:
    - name: image_name
      image: eu.gcr.io/container:latest
      volumeMounts:
        - mountPath: &lt;docker_dir&gt;
          name: dir
</code></pre>
<p>I am missing out where the binding between the host and container/pod directories will take place. Also where do I mention that binding in my yaml files.</p>
<p>I will appreciate any help :)</p>

<p>You are on the right path here.  In your Pod spec, the name of the volumeMount should match the name of the volumes.  So in your case,</p>
<pre><code>volumes:
    - name: pvc
      persistentVolumeClaim:
       claimName: pvc
</code></pre>
<p>volume name is <code>pvc</code>. So your volumeMount should be</p>
<pre><code>volumeMounts:
        - mountPath: &quot;/path/in/container&quot;
          name: pvc
</code></pre>
<p>So, for example, to mount this volume at <code>/mydata</code> in your container, your Pod spec would look like</p>
<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: k8s-pod
spec:
  volumes:
    - name: pvc
      persistentVolumeClaim:
       claimName: pvc
  containers:
    - name: image_name
      image: eu.gcr.io/container:latest
      volumeMounts:
        - mountPath: &quot;/mydata&quot;
          name: pvc
</code></pre>
