How to successfully run Jenkins inside a Kubernetes Cluster

Opcito Technologies
2 min readMar 19, 2020

Jenkins is a free and open-source automation server. It assists you to set up a continuous integration or continuous delivery for various combinations of languages. Also, you can set up source repositories using pipelines and automate other regular development tasks. With Jenkins, you can organize your build, test, and deployment pipelines as per the requirements. To set up a continuous delivery (CD) pipeline, Jenkins deployed in Kubernetes Engine is normally the go-to option. It has important benefits over a standard VM-based deployment which are as follows:

  • The build process uses containers and a single virtual host runs various jobs against different operating systems.
  • Build transitory executors with Kubernetes Engine allows each build to run in neat surroundings similar to the previous builds.
  • Kubernetes cluster is only used when builds are active during the transition of build executors. The resources available for other cluster tasks like batch processing jobs are unaccounted.
  • It builds the executor’s launch in just a few seconds.

I will try to explain how to run Jenkins inside the Kubernetes cluster and dynamically leverage the pods as Jenkins slave with a simple demo. Before you begin just clone the repo. You need to create a Kubernetes cluster and for the demo, I will use GKE.

Connect to cluster and get kubeconfig by typing `kubectl config view –raw`. This kubeconfig will be used to access the K8s cluster from your local machine. After accessing the K8s cluster, use the Helm chart to install Jenkins on the GKE cluster. A Helm chart is used to deploy an application or just one component of a large application. Then, extract Helm chart values in a file to change the values as per the requirements using `helm inspect values stable/jenkins > jenkins.values`…read more

--

--

Opcito Technologies

Product engineering experts specializing in DevOps, Containers, Cloud, Automation, Blockchain, Test Engineering, & Open Source Tech