Serverspace has added a new Rocky Linux OS
December 21, 2022
Updated June 7, 2023

How to install Jenkins on Kubernetes

Kubernetes Linux Ubuntu


Jenkins — is a continuous integration server that is distributed open source in the Java language. In this publication we will install this CI using kubernetes clusters.
Kubernetes is software for orchestrating containerized applications - automating their deployment, scaling, and coordination in a cluster environment. Thanks to containerization, you can easily restrict applications from each other, as well as change the allocated server resources from one application to another if needed.

In Serverspace, you can create a ready-made Kubernetes cluster, because it is convenient!


  • At least 2 CPUs to implement a kubernetes server
    Or rent a kubernetes server
  • Client server, for managing and configuring kubernetes clusters


Before installing CI, you need to deploy Kubernetes. To do this in Serverspace infrastructure, simply log in to your personal account, then go to Kubernetes and start the installation:


Configure the dedicated cluster according to the characteristics you need, don't forget to give it a name.

P.s It will take about 15 minutes to create the cluster, be patient.

After creating the cluster, you will be able to download the configuration file of the server with Cubernetes. You will need this config file later when installing CI, to link the client-server and the server with the kubernetes clusters.


Download the configuration file to your computer, upload it to the server by choosing one of the suggested solutions:

  • You can create a new file and put the kubernetes cluster config into it.
nano config-kubernetes

Insert the kubernetes config file into the created file and save it.

  • You can upload the file remotely using the SFTP protocol.

Getting started

Install the necessary packages for the CI installation.

sudo apt-get update && sudo apt-get install -y apt-transport-https
curl -s | sudo apt-key add -
echo "deb kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl

Specify the location of the k8s server configuration file.

export KUBECONFIG=<your path to config>


P.s. We copied/created this file after starting the kubernetes server.

Check the connection to the server.

kubectl cluster-info



Create a space for CI.

kubectl create namespace <your_namespace>

To install and run CI on a Kubernetes server, we need to create a configuration file, with our server settings.

nano our_project_jen.yaml

Enter these parameters into the created configuration file.

apiVersion: apps/v1
kind: Deployment
name: jenkins
replicas: 1
app: jenkins
app: jenkins
- name: jenkins
image: jenkins/jenkins:lts
- name: http-port
containerPort: 8080
- name: jnlp-port
containerPort: 50000
- name: jenkins-vol
mountPath: /var/jenkins_vol
- name: jenkins-vol
emptyDir: {}

This configuration file will deploy the latest CI release. Also the ports specified in the configuration will be created and opened, you can change them to what you need.

Now point the created space which configuration file to use.

kubectl create -f jenkins.yaml --namespace <your_namespace>

Wait for the cluster to install the jenkins image and run it, use the command below to test the module.

kubectl get pods -n jenkins

After running the image, I will create two more services to use the web version of jenkins.
Create and modify the service configuration file.

nano jenkins-service.yaml

Add these settings to the created file.

Point cluster to use this configuration file with the same space created.

kubectl create -f jenkins-service.yaml --namespace <your_namespace>

Checking status of the service.

kubectl get services --namespace jenkins

Use this command to see the ip address, or you can look it up in the kubernetes cluster control panel.

kubectl get nodes -o wide

Before going to the web version, get the password of the Jenkins superuser.

kubectl logs jenkins-CHANGE -n jenkins

Where "CHANGE" is the name of your container.


The password is in the logs of our running image.


Go to the web version of CI to continue the installation, enter in the dialog box the password that we learned earlier.


To complete installing Jenkins, follow the instructions provided with the web version.



In this publication I demonstrated how to deploy Jenkins CI using dedicated kubernetes server resources from Serverspace.

5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.