Home > Mobile >  Exposing or accessing Jenkins using Ingress
Exposing or accessing Jenkins using Ingress

Time:12-13

I'm trying to setup my Jenkins instance in our On-premise Kubernetes cluster v1.18.6. Went thru multiple posts on the internet explaining the steps but using nodeport IP and not using the ingress.

I'm looking for

  1. Domain under which I want to access Jenkins: jenkins.BU.org.com/jenkins.
  2. Master slaves communication using ingress controller. I believe Jenkins uses a custom protocol for communicating with its build agents, being Java RMI, and not HTTP based.

What other extra changes I've to make from my end in addition to the steps mentioned in the below document.

Very new to Kubernetes and its dynamics, so any help here would be great for my learning, thanks.

https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-kubernetes

CodePudding user response:

So starting out from bare bones I assume following things:

  • You have a configured Kubernetes cluster available to you
  • You have the Ingress controller installed in your cluster

First thing to make clear:

Workloads which run within the Kubernetes cluster should communicate via Service resources and not Ingress resources.

Second thing to keep in mind is:

Use Ingress resource to make your workloads reachable from outside of your cluster

And lastly since you are hoping to make your Jenkins instance accessible under jenkins.BU.org.com/jenkins then you will have to pick one of the following:

  • Buy the org.com domain, since jenkins.BU.org.com is a subdomain of org.com domain
  • Setup your own private networking ( out of scope of this question and my knowledge honestly )

So to answer your question you will need to do following things to make your Jenkins instance accessible from outside of the cluster:

  • Create your Jenkins master Pod with some port open, say 8080
  • Create a Service resource which selects your Pod and forwards the port 80 to port 8080
  • Create an Ingress resource which forwards your desired domain name to your Service onto port 80
  • Create a LoadBalancer service to target your Ingress controller Pods
  • Associate the LoadBalancer service with your actual load balancer ( depending on your environment )
  • Associate your domain name to load balancer IPs for DNS resolution

Another way to solve this would be:

  • Create your Jenkins master Pod with some port open, say 8080
  • Create a Service resource of type NodePort which selects your Pod and forwards the port 80 to port 8080. This will open a port on your Node, and then you should be able to access your Pod via the IP address of the node.
  • Configure the DNS to resolve your desired domain name to the IP of your node.

I would not recommend second approach, since it would imply making your node available to the internet directly.

  • Related