<p>I understand that in Kubernetes you don't want to "tie" a pod to a host, but in certain cases you might need to. </p>

<p>In my particular case I have a DB that lives on blockstorage which is mounted to a specific host. </p>

<p>What I am trying to accomplish with Kubernetes is the equivalent of a bind-mount in Docker. I want to specify the directory on the host that I need mounted in the pod, similar to this:</p>

<pre><code>/mnt/BTC_2:/root/.bitcoin:rw
</code></pre>

<p>How do I specify the location of where I want my persistent storage to be on the node/host? Would this be a <code>hostPath</code> volume like the following:</p>

<pre><code>    volumeMounts:
    - mountPath: /root/.bitcoin
      name: test-volume
  volumes:
  - name: test-volume
    hostPath:
      # directory location on host
      path: /mnt/BTC_2
</code></pre>

<blockquote>
  <p>I want to specify the directory on the host that I need mounted in the pod</p>
</blockquote>

<p>That should be <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">documented here</a></p>

<blockquote>
  <p>A hostPath volume mounts a file or directory from the host node’s filesystem into your pod. This is not something that most Pods will need, but it offers a powerful escape hatch for some applications.</p>
</blockquote>

<p>Warning:</p>

<blockquote>
  <p>The files or directories created on the underlying hosts are only writable by root. You either need to run your process as root in a privileged container or modify the file permissions on the host to be able to write to a hostPath volume</p>
</blockquote>

<pre><code>  volumes:
  - name: test-volume
    hostPath:
      # directory location on host
      path: /data
      # this field is optional
      type: Directory
</code></pre>
