<p>My team doesn't have all our code in the same place locally but we are all working on the same service. This service depends on a few other libraries and during the development it would be great to have the live version of those libs mounted into the pod for faster iteration.</p>
<p>How the path becomes dynamic doesn't matter, env var, config map, weird volume mount sorcery, etc...</p>
<p>My current approach uses helm to template out the yaml. I was hoping to be able to do something like this:</p>
<pre><code> volumes:
   - name: my-lib
     hostPath:
       path: $CODE_PATH/my_lib
 volumeMounts:
   - name: my-lib
     mountPath: /tmp/my_lib
</code></pre>
<p>Where my team members could externally define <code>CODE_PATH</code>, allowing them to point to where they keep their code. I'm not attached to a method for doing this. Currently, mine doesn't work anyway. I just need to be able to mount a host directory into a pod without statically defining an absolute path right in the yaml.</p>

LISTERINE
<p>According to the official documentation there are 2 ways to achieve this but in both of them the <code>hostPath</code> has to be defined.</p>
<p>First approach would be to use <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">hostPath</a>, where <code>hostPath</code> volume uses the local disk of the node to mount the volume and specify the <code>hostPath</code> in Preferences-&gt;File Sharing in Docker Desktop.</p>
<p>Second approach would be to use a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage" rel="nofollow noreferrer">PersistentVolume</a> approach in which cluster administrator creates the volumes and pods can access them through <code>PersistentVolumeClaims</code>, a level of abstraction between the volume and its storage mechanism.</p>
