<p>I am using k3d to run local kubernetes</p>
<p>I have created a cluster using k3d.</p>
<p>Now I want to mount a local directory as a persistent volume.</p>
<p>How can i do this while using k3d.</p>
<p>I know in minikube</p>
<pre><code>$ minikube start --mount-string=&quot;$HOME/go/src/github.com/nginx:/data&quot; --mount
</code></pre>
<p>Then If you mount /data into your Pod using <code>hostPath</code>, you will get you local directory data into Pod.</p>
<p>Is there any similar technique here also while using k3d</p>

<p>According to the answers to <a href="https://github.com/k3d-io/k3d/issues/566" rel="nofollow noreferrer">this Github question</a> the feature you're looking for is not available yet.</p>
<p>Here is some idea from this link:</p>
<blockquote>
<p>The simplest I guess would be to have a pretty generic mount containing all the code, e.g. in my case, I could do <code>k3d cluster create -v &quot;$HOME/git:/git@agent:*&quot;</code> to get all the repositories on my host present in all agent nodes to be used for hot-reloading.</p>
</blockquote>
<p>According to <a href="https://k3d.io/v5.2.0/usage/commands/k3d_cluster_create/" rel="nofollow noreferrer">this</a> documentation one can use the following command with the adequate flag:</p>
<pre class="lang-yaml prettyprint-override"><code>k3d cluster create NAME -v [SOURCE:]DEST[@NODEFILTER[;NODEFILTER...]]
</code></pre>
<p>This command mounts volumes into the nodes</p>
<pre><code>(Format:[SOURCE:]DEST[@NODEFILTER[;NODEFILTER...]]
</code></pre>
<p>Example:</p>
<pre><code>`k3d cluster create --agents 2 -v /my/path@agent:0,1 -v /tmp/test:/tmp/other@server:0`
</code></pre>
<p><a href="https://dev.to/bbende/k3s-on-raspberry-pi-volumes-and-storage-1om5" rel="nofollow noreferrer">Here</a> is also an interesting article how volumes and storage work in a K3s cluster (with examples).</p>
