Mohit Thakur
Mohit Thakur

Reputation: 19

Kubernetes Jenkins connectivity Issue

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.

My Jenkins pod IP:- 10.43.0.8

My Kubernetes Master private IP:- 192.168.105.229

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.

IMG1] IMG2]

Upvotes: 0

Views: 1314

Answers (2)

csanchez
csanchez

Reputation: 1659

If you want to access a pod running in Kubernetes you need to expose it as a service and possibly an ingress resource https://kubernetes.io/docs/concepts/services-networking/service/

Upvotes: 0

Rico
Rico

Reputation: 61699

There are a few ways to do this. A couple that I can think of:

  • Use the Jenkins Kubernetes Plugin. 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 authentication and RBAC in Kubernetes

  • Manually configure Jenkins slaves running as 'user'. Then on the 'user's some directory create a ~/.kube/config that has the configuration to talk to your Kubernetes cluster. From there you can just issue kubectl commands to create/remove pods. You would still need to configure authentication/RBAC.

Upvotes: 1

Related Questions