<p>I set up the kubernetes on EC2 instances over ubuntu platform, everything working fine. But now I have deployed a Jenkins pod, after that, I am able to access the Jenkins in the browser. Now my question is how can I connect Jenkins with my machine.</p>

<p>My Jenkins pod IP:- <code>10.43.0.8</code></p>

<p>My Kubernetes Master private IP:- <code>192.168.105.229</code></p>

<p>I am able to ping with each other. But how I can access my master machine using Jenkins, so I can create the pods through Jenkins.</p>

<p><a href="https://i.stack.imgur.com/k7nEY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k7nEY.png" alt="IMG1]"></a>
<a href="https://i.stack.imgur.com/30q8j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/30q8j.png" alt="IMG2]"></a></p>

Mohit Thakur
<p>There are a few ways to do this. A couple that I can think of:</p>

<ul>
<li><p>Use the <a href="https://github.com/jenkinsci/kubernetes-plugin" rel="nofollow noreferrer">Jenkins Kubernetes Plugin</a>. If you install this on your Jenkins master (which is also running on a pod) and also if you configure it to talk to the same Kubernetes cluster (meaning the kube-apiserver) then you can create/remove pods using the plugin. More on how to configure <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/" rel="nofollow noreferrer">authentication</a> and <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/" rel="nofollow noreferrer">RBAC</a> in Kubernetes </p></li>
<li><p>Manually configure Jenkins slaves running as 'user'. Then on the 'user's some directory create a <code>~/.kube/config</code> that has the configuration to talk to your Kubernetes cluster. From there you can just issue <code>kubectl</code> commands to create/remove pods. You would still need to configure authentication/RBAC.</p></li>
</ul>
