There is no */test-mnt* mount point on host, still pod is *running* fine and eve . . .

ameya agashe:
There is no /test-mnt mount point on host, still pod is running fine and even reports the percentage of disk used. I am confused!!

Can someone please help me understand ?

[root@master1 ~]$  cat nginx-hostpath.yaml
apiVersion: v1
kind: Pod
metadata:
  name: nginx-hostpath
spec:
  containers:
    - name: nginx-container
      image: nginx
      volumeMounts:
      - mountPath: /test-mnt
        name: test-vol
  volumes:
  - name: test-vol
    hostPath:
      path: /test-vol
[root@master1 ~]$  ls -larth /test-mnt
ls: cannot access '/test-mnt': No such file or directory
[root@master1 ~]$  df -Ph |grep test
[root@master1 ~]$  k get po
NAME                           READY   STATUS    RESTARTS       AGE
nginx-hostpath                 1/1     Running   0              5m12s
test-deploy-7955784f5c-9bkg6   1/1     Running   1 (9m8s ago)   18h
test-deploy-7955784f5c-rgkq8   1/1     Running   1 (9m9s ago)   18h
[root@master1 ~]$  kubectl exec nginx-hostpath -- df /test-mnt
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        9983232 5227388   4739460  53% /test-mnt

Vitor Jr.:
Hi @ameya agashe, are you sure your pod is running in the master node? Can you check with kubectl get pod nginx-hostpath -o wide and then check in the node if the path wasn’t created?

Vitor Jr.:
I just tested here with minikube and launched this YAML, and the hostPath in the node was created automatically.

ameya agashe:
Sir, it was created on worker-2

Vitor Jr.:

ameya agashe:
My understanding is the mount point should exists and not that pod would create but it seems it is otherwise?

Vitor Jr.:
Here you are validating in the master node

ameya agashe:
so my question is mount point should be already existing or is created by pod?

Vitor Jr.:

ameya agashe:
Muchas gracias @Vitor Jr. :heart:

Vitor Jr.:
¡No problemo mi compañero! :slightly_smiling_face: