<p>I want do some device initiation by using Daemonset(K8s resource).</p>
<p>Actually the deivce has been formated(inside container) and mounted(inside container) successfully to a container path <code>/hostmnt/lvpmem/</code> which is mapped of <code>/mnt/</code> which is a host path.</p>
<p><code>mountpoint</code> works fine in container</p>
<pre><code>[root@driver-hm4ll /]
#mountpoint /hostmnt/lvpmem/
/hostmnt/lvpmem/ is a mountpoint
</code></pre>
<p>but <code>mountpoint</code> works wrong in host env</p>
<pre><code>[root@host ~]# mountpoint  /mnt/lvpmem/
/mnt/lvpmem/ is not a mountpoint
</code></pre>
<p>Also the data I write in container under <code>/hostmnt/lvpmem/</code> can't been seen under <code>/mnt/lvpmem/</code> in host env.</p>
<p>How can I mount the device so that both host and container can see it ?<br />
Also, if container is destroyed does the mount relation also be destroyed ? I have no idea about umounting the device in host env if mount relation can't be seen.<br />
Some opensource project use <code>nsenter</code> in container to run such format/mount command does it help ?</p>

<ul>
<li>add /mnt as a volume to pod on directory /hostmnt. So that whatever being written under /hostmnt  directory (insisde the container) will be seen on host under directory /mnt .</li>
</ul>
<pre><code>Example of a pod with hostpath :

apiVersion: v1
kind: Pod
metadata:
  name: test-pd
spec:
  containers:
  - image: k8s.gcr.io/test-webserver
    name: test-container
    volumeMounts:
    - mountPath: /hostmnt
      name: test-volume
  volumes:
  - name: test-volume
    hostPath:
      # directory location on host
      path: /mnt
      # this field is optional
      type: Directory

</code></pre>
