<p>I am running a Jenkins docker container, which I want to configure the Kubernetes plugin which requires passing kubeconfig file. How can I point the kubeconfig file in my local machine to the Jenkins running in the container? I am running the k3d Kubernetes cluster on my host machine.</p>

DevOps_DS
<p>You can <strong>mount</strong> the host directory to the container.</p>
<p>So your host directory will be accessible inside the <strong>Jenkins</strong> container and you can access the files also.</p>
<p>This way just mount your <code>.kube</code> folder to Jenkins container, which is storing the <code>kubeconfig</code> file. And you can use that path in jenkin config.</p>
<p>Create a home directory for Jenkins in the host.</p>
<pre><code> sudo mkdir /mykubeconfig
</code></pre>
<p>copy-paste the <code>kubeconfig</code> file inside above created directory</p>
<p>Run the latest Jenkins container using the following command.</p>
<pre><code> docker run  -d -p 8080:8080 -p 50000:50000 -v /mykubeconfig:/var/jenkins_home jenkins
</code></pre>
<p>Now you will be able to access jenkins on host port 8080.</p>
