<p>I am running application on k8s.</p>

<p>My docker file is like :</p>

<pre><code>FROM python:3.5 AS python-build
ADD . /test
WORKDIR /test
</code></pre>

<p>in test directory, i am doing everything my files inside this test folder.</p>

<p>when i go inside pod and check file structure it's like <code>/var /usr /test /bin</code></p>

<p>so i want to add whole folder test in pvc</p>

<p>in test file structure is like <code>/app /data /history</code></p>

<p>so can i save add folder attach to pvc using mountpath?</p>

<p>is it possible two mountpath but one pvc ?</p>

Harsh Manvar
<p>As I understand, you want to include your test directory as a mount path in your PVC. To answer that question, yes you can do it by providing it in the hostpath not the mount path. As explained in the documentation :-</p>

<blockquote>
  <p>A hostPath volume mounts a file or directory from the host node’s filesystem into your Pod. This is not something that most Pods will need, but it offers a powerful escape hatch for some applications.</p>
</blockquote>

<p>and a mount path is -</p>

<blockquote>
  <p>The location in pod where the volume should be mounted.</p>
</blockquote>

<p>so, if from your host system you want to mount the \test folder you need to provide it in the pv like below</p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: task-pv-volume
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/test"
</code></pre>

<p>and you can use this PV to claim a volume using pvc and use the <strong>mountPath</strong> to mount that volume into your pod.</p>

<p>To answer your second question, yes you can have multiple mount paths for a single PVC. An example of this which works is :-</p>

<pre><code>    "containers": [
    {
        ...,
        "volumeMounts": [
         {
             "mountPath": "/mnt/1",
             "name": "v1",
             "subPath": "data/1"
         },
         {
             "mountPath": "/mnt/2",
             "name": "v1",
             "subPath": "data/2"
         }
       ]
    }
   ],
   ...,
   "volumes": [
       {
           "name": "v1",
           "persistentVolumeClaim": {
                "claimName": "testvolume"
           }
       }
     ]
  }
}
</code></pre>
