title: Persistent storage: How to mount a directory in Kubernetes?
body: <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>