Sign inSign up

devops4me/jenkins

By devops4me

•Updated about 5 years ago

Jenkins image with the ability to connecto to Kubernetes to run build jobs.

Image
0

3.2K

devops4me/jenkins repository overview

⁠Jenkins on Kubernetes in 5 Minutes

After 3 commands Jenkins will execute sample pipeline jobs on a Kubernetes cluster.

Follow this to install a microk8s kubernetes cluster⁠ on your laptop and optionally other nodes.


⁠Step 1 | Run Jenkins on Kubernetes

These are the 3 commands to run both the Jenkins master and the workers on a (possibly) distributed Kubernetes cluster.

git clone https://github.com/devops4me/docker-jenkins.git
cd docker-jenkins
kubectl apply -f jenkins-deployment.yaml

That's it. Your Kubernetes orchestrated Jenkins cluster is ready.


⁠Step 2 | View Jenkins jobs running in Kubernetes

The sample jobs include

  • a JAVA microservice and
  • a JAVA library
kubectl get services -o wide
kubectl -n default logs -f deployment/jenkins --all-containers=true --since=5m
watch kubectl get pods -o wide

Visit the Jenkins UI with the IP address against the Jenkins service. Go to the jobs, click Build Now and then watch both the logs and the pods showing Kubernetes running dockerized pipelines on one or more nodes.


⁠Appendix | Kubernetes Jenkins Plugin

To view or change how the Kubernetes plugin configuration go to Jenkins | Manage Jenkins | Configure System and scroll down to the clouds section. The default configuration assumes

  • the kubernetes API url is https://kubernetes.default.svc from inside the cluster
  • the Jenkins master url the slaves connect to is http://jenkins as jenkins is the service name
  • the Jenkins master and slaves pods all run in the default Kubernetes namespace

This sample Java microservice⁠ shows how the Jenkinsfile and the pod-template yaml are written to fascilitate execution on a Kubernetes platform.

Tag summary

Content type

Image

Digest

Size

587.4 MB

Last updated

about 5 years ago

docker pull devops4me/jenkins