<p>I'm studying for the CKAD and I'm trying to create a <code>PersistenVolume</code> of type <code>hostPath</code> on my local minikube cluster and mount to a container</p>
<p>These are the steps:</p>
<ol>
<li>I created a PV of type <code>hostPath</code> and <code>path: &quot;/data/vol1/&quot;</code></li>
<li>I created a PVC and its state is <code>Bound</code></li>
<li>I created a POD and mounted the PVC as volume under &quot;/var/something/&quot;</li>
<li>I ran <code>minikube ssh</code> and created a file <code>/data/vol1/foo.bar</code></li>
<li>I expected to see the file <code>foo.bar</code> under the folder /var/something/` of the container, but it's not there.</li>
</ol>
<p>This is the yaml file</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: 1311-pv
spec:
  capacity:
    storage: 2Gi
  hostPath:
    path: &quot;/data/vol1/&quot;
  accessModes:
    - ReadWriteMany

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: 1311-pvc
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: ex10
spec:
  volumes:
  - name: pvc
    persistentVolumeClaim:
      claimName: 1311-pvc
  containers:
  - image: httpd
    name: web
    volumeMounts:
    - mountPath: &quot;/var/something/&quot;
      name: pvc
</code></pre>
<p>And this is the status of the system:</p>
<pre><code>k get pvc
NAME       STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
1311-pvc   Bound    pvc-c892f798-8ee6-4040-9177-3e77327e9ec6   1Gi        RWX            standard       5m
</code></pre>
<pre><code>k get pv
NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM              STORAGECLASS   REASON   AGE
1311-pv                                    2Gi        RWX            Retain           Available                                              13m
pvc-c892f798-8ee6-4040-9177-3e77327e9ec6   1Gi        RWX            Delete           Bound       default/1311-pvc   standard                13m
</code></pre>
<pre><code>pod describe ex10

...
 Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-lw45q (ro)
      /var/something/ from pvc (rw)
.... 
</code></pre>
<p>Everything looks correct to be, but I don't see the file inside the container:</p>
<pre><code>k exec ex10  -- ls /var/something
- no results here - 
</code></pre>
<p>that I created into the minikube vm:</p>
<pre><code>ssh minikube

$ ls /data/vol1/
foo.bar
</code></pre>

Daddy Zug
<p>I found a solution for this issue, the PV must specify the <code>storageClassName: standard</code> in order to work.</p>
<p>This is how the PV should look like to properly store data into minikube host</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: 1311-pv
spec:
  storageClassName: &quot;standard&quot;
  capacity:
    storage: 2Gi
  hostPath:
    path: &quot;/host/&quot;
  accessModes:
    - ReadWriteMany
</code></pre>
