Installing Jenkins on Kubernetes

Thursday, Aug 8, 2019| Tags: kubernetes, containers, docker, jenkins, CICD

In this post I will cover the steps to install Jenkins in a Kubernetes cluster. While Jenkins can be installed on standard VMs, if you are running a Kubernetes cluster then its much easier to install and run Jenkins in it.

We will be using Helm to install Jenkins.

We will follow the below steps to get up and running:

  1. Get the Jenkins values file for configuring our Jenkins installation
  2. Install Jenkins
  3. Access Jenkins

Let’s rock ‘n’ roll:

Step 1. Get the Jenkins values file for configuring our Jenkins installation

First get the Jenkins Helm values file for configuring our Jenkins installation.

wget -O jenkins-values.yaml


  serviceType: LoadBalancer
  serviceType: ClusterIP

We don’t want to expose Jenkins directly via a LoadBalancer and use an ingress instead (Not covered in this blog)

Step 2. Install Jenkins

Run the below command:

helm install stable/jenkins --name=jenkins --namespace=jenkins -f jenkins-values.yaml

This will install jenkins in your cluster.

Step 3. Access Jenkins

To log on to Jenkins, let’s get the credentials.

Get the password for jenkins admin user by running below command:

kubectl -n jenkins get secret jenkins -o=jsonpath='{.data.jenkins-admin-password}' | base64 --decode

You can then log on to jenkins using the user admin and the password you retrieved.

You can now use port forwarding to access jenkins. Run the below command:

kubectl -n jenkins port-forward svc/jenkins 8080:8080

Now you can head on to the http://localhost:8080 to access Jenkins

In order for Jenkins to be accessible over the internet/intranet you can expose it using an ingress.