<p>I am learning about Volumes in the <code>Kubernetes</code>.<br />
I understood the concept of Volume and types of volume.<br />
But, I am confused about the <code>mouthPath</code> property. Following my <code>YAML</code> file:</p>
<pre><code>apiVersion: v1 
kind: Pod 
metadata:
  name: nginx-alpine-volume
spec:   

containers: 
  - name: nginx 
    image: nginx:alpine 
    volumeMounts: 
      - name: html 
        mountPath: /usr/share/nginx/html
        readOnly: true 
    resources:
  - name: html-updater 
    image: alpine 
    command: [&quot;/bin/sh&quot;, &quot;-c&quot;] 
    args: 
      - while true; do date &gt;&gt; /mohit/index.html;sleep 10; done 
    resources:
    volumeMounts: 
      - name: html 
        mountPath: /mohit
  volumes: 
  - name: html 
    emptyDir: {}
</code></pre>
<p>Question: What is the use of the <code>mountPath</code> property. Here, I am using one pod with two containers. Both containers have different <code>mounPath</code> values.</p>
<h2>Update:</h2>
<p><a href="https://i.stack.imgur.com/qvqJI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qvqJI.jpg" alt="enter image description here" /></a></p>

KiddoDeveloper
<p>Consider the mount path as the directory where you are attaching or mounting the files or system</p>
<p>While your actual volume is <strong>emptyDir</strong></p>
<p>What basically the idea is there to both container have different mount path</p>
<p>as both containers need to use different folders</p>
<p>While as your volume is single name html so locally from volume both container pointing or using the different folders</p>
<p>both containers manage the different files at their mounting point (or folder)</p>
<p>so mount path is a point or directly where your container will be managing files.</p>
<p>Empty dir : <a href="https://kubernetes.io/docs/concepts/storage/volumes/#emptydir" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/storage/volumes/#emptydir</a></p>
<p>Read more at : <a href="https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/</a></p>
<p>if you see this example: <a href="https://github.com/harsh4870/Kubernetes-wordpress-php-fpm-nginx/blob/master/wordpress-deployment.yaml" rel="nofollow noreferrer">https://github.com/harsh4870/Kubernetes-wordpress-php-fpm-nginx/blob/master/wordpress-deployment.yaml</a></p>
<p>it has the same two containers with mount path and <strong>emptydir</strong> volume</p>
<p>what i am doing is attaching the Nginx configuration file, to the container so Nginx will use that configuration file which i am mounting from outside to the container.</p>
<p>My config file stored inside <strong>configmap</strong> or <strong>secret</strong>.</p>
