<p>I am trying to mount a local folder to a container. Every step went well without any errors but I still can't see the mounting.</p>
<p>I created a file <code>index.html</code> in <code>/home/azureuser/mnt/host</code></p>
<p>my target is to mount local folder <code>host</code> to <code>/usr/share/nginx/html0</code> in the container.</p>
<h2>pv.yaml</h2>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 100Mi
  hostPath:
    path: &quot;/home/azureuser/mnt/host&quot;
</code></pre>
<h2>pvc.yaml</h2>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Mi
</code></pre>
<h2>pod.yaml</h2>
<pre><code>kind: Pod
apiVersion: v1
metadata:
  name: pod0
  labels:
    name: pod
spec:
  volumes:
    - name: mount
      persistentVolumeClaim:
        claimName: pvc
  containers:
    - name: container
      image: nginx
      ports:
        - containerPort: 80
      volumeMounts:
        - name: mount
          mountPath: /usr/share/nginx/html0
      resources:
        limits:
          memory: &quot;128Mi&quot;
          cpu: &quot;250m&quot;
</code></pre>
<p>upon on applying the three yaml in the order of the appearance. I shelled in to the <code>pod0</code> and <code>ls -al /usr/share/nginx/html0</code> it is <code>empty</code>. Also there is no symbolic link to <code>html0</code> to  <code>host</code></p>
<p>Fyi the entire thing is happening in azure and it is minikube</p>
<pre><code>kubectl get pod -o wide


NAME   READY   STATUS    RESTARTS   AGE   IP           NODE       NOMINATED NODE   READINESS GATES
pod0   1/1     Running   0          26h   172.17.0.4   minikube   &lt;none&gt;           &lt;none&gt;
</code></pre>

Bhanu Tez
<p>As you are using <a href="https://minikube.sigs.k8s.io/docs/" rel="nofollow noreferrer">Minikube</a> it changed a bit my point of view.</p>
<h3>Background</h3>
<p>In <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro/" rel="nofollow noreferrer">Using Minikube to Create a Cluster</a> documentation you can find information, that</p>
<blockquote>
<p>Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node.</p>
</blockquote>
<p>You mention, that you have created file</p>
<blockquote>
<p>I created a file index.html in /home/azureuser/mnt/host</p>
</blockquote>
<p>I guess you have created it in your <code>Azure VM</code>, but as you are using <code>Minikube</code>, it should be created in <code>Minikube VM / Docker conainter</code> inside your <code>Azure VM</code>. It depends on driver you have used.</p>
<h3>Tests</h3>
<p>In my test I've used <code>docker driver</code> which creates <code>minikube container</code> where it stores it's data.</p>
<p>I have created VM and started <code>Minikube</code> with <code>docker driver</code>.</p>
<p>After creation, you are logged to your VM (I've already deployed your YAMLs).</p>
<pre><code>user@minikube-new:~$ ls
minikube-linux-amd64  po.yaml  pv.yaml  pvc.yaml
user@minikube-new:~$ kubectl get po
NAME   READY   STATUS    RESTARTS   AGE
pod0   1/1     Running   0          26s
</code></pre>
<p>After applying your YAMLs there should be <code>/home/azureuser/mnt/host</code> but it's not there.</p>
<pre><code>user@minikube-new:~$ pwd
/home/user
</code></pre>
<p>Minikube during starting, <strong>creates own docker container inside your VM</strong>. You can enter it using <code>minikube ssh</code>.</p>
<pre><code>$ minikube ssh
Last login: Thu Jan  7 09:16:46 2021 from 192.168.49.1
docker@minikube:~$ pwd 
/home/docker
docker@minikube:~$ cd ..
docker@minikube:/home$ ls
azureuser  docker
docker@minikube:/home$ cd azureuser/mnt/host/
docker@minikube:/home/azureuser/mnt/host$ touch index.html
touch: cannot touch 'index.html': Permission denied
</code></pre>
<p>I've changed permissions to <code>host</code> directory (<code>chmod</code>) and created file.</p>
<pre><code>docker@minikube:/home/azureuser/mnt/host$ touch index.thml
docker@minikube:/home/azureuser/mnt/host$ echo &quot;This is test message from Minikube MV&quot; &gt; index.html
docker@minikube:/home/azureuser/mnt/host$ cat index.thml 
This is test message from Minikube MV
docker@minikube:/home/azureuser/mnt/host$ exit
logout
user@minikube-new:~$ 
</code></pre>
<p>Now if you will check your pod <code>/usr/share/nginx/html0</code> folder, you will find <code>index.html</code>.</p>
<pre><code>user@minikube-new:~$ kubectl exec -ti pod0 -- bash
root@pod0:/# cd /usr/share/nginx/html0
root@pod0:/usr/share/nginx/html0# ls
index.thml
root@pod0:/usr/share/nginx/html0# cat index.thml 
This is test message from Minikube MV
</code></pre>
<h3>Conclusion</h3>
<p>When you are creating <code>Minikube</code> you are automatically creates new <code>Minikube VM/container</code> inside your <code>Azure VM</code>. To enter <code>Minikube VM/container</code> you have to use <code>minikube ssh</code> command. If you will configure pod to use <code>Persistent Volume</code> with <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">HostPath</a> it will be mount to <code>Minikube VM/container</code> not your <code>Azure VM</code>.</p>
<blockquote>
<p>A hostPath volume mounts a file or directory from the host node's filesystem into your Pod.</p>
</blockquote>
