<p>Let's say I create a PersistentVolume of type hostPath:</p>
<pre class="lang-yaml prettyprint-override"><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: mypv
spec:
  storageClassName: normal
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: /etc/foo  # Path on the host machine
</code></pre>
<p>and I create the corresponding PersistentVolumeClaim, and use it in a Pod:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  labels:
    run: busybox
  name: busybox
spec:
  containers:
  - image: busybox
    name: busybox
    volumeMounts:
    - name: myvolume
      mountPath: /var/log # is this relative to the hostPath of the PV?
  restartPolicy: Never
  volumes:
  - name: myvolume
    persistentVolumeClaim
      claimName: mypvc
status: {}
</code></pre>
<p>Is it expected that the result would be <code>{hostPath}/{mountPath}</code> (e.g. <code>/etc/foo/var/log</code>), or would I have to specifically define <code>mountPath: /etc/foo/var/log</code> to get it there?</p>

KJ0797
<p>The <code>mountPath</code> is the mountpoint inside the container. It is an absolute path starting at the <em>container's</em> filesystem root. If <code>mountPath</code> is <code>/var/log</code>, then the volume will be mounted on <code>/var/log</code> inside the container.</p>
<p>If you have a <code>hostPath</code> volume pointing at <code>/etc/foo</code> on the host and <code>mountPath</code> pointing at <code>/var/log</code> in the container, then you will find the contents of <code>/etc/foo</code> available inside <code>/var/log</code> inside the container.</p>
<p>For more details, see <a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="noreferrer">the documentation</a>.</p>
