Difficulty: Introduction
Estimated Time: 20 minutes

Jenkins on Kubernetes


Canary Releases with Jenkins on Kubernetes

This demonstration covers these topics:

  • A personal Kubernetes cluster
  • Install and configure Jenkins from Helm chart
  • Installing Prometheus from Helm chart
  • Demonstrating Kubernetes plugin for Jenkins
  • Build, deploy and run container from Jenkinsfile
  • Update container with canary deployment
  • Monitoring canary deployments
  • Rollback canary

Canary release is a technique to reduce the risk of introducing a new software version in production by slowly rolling out the change to a small subset of users before rolling it out to the entire infrastructure and making it available to everybod. - MartinFowler.com

Instructions Overview

  • Start a personal Kubernetes cluster
  • Create a Quay.io robot account and copy the credentials
  • Install Jenkins on the cluster
  • Configure Jenkins to leverage Kubernetes
  • Create a pipeline that builds on and publishes to Kubernetes
  • Roadmap: Add Prometheus-Operator monitoring stack from Helm charts
  • Roadmap: Observe monitoring of a deployed container
  • Roadmap: See how canary deployments work with this workflow

Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat. It supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, ClearCase and RTC, and can execute Apache Ant, Apache Maven and sbt based projects as well as arbitrary shell scripts and Windows batch commands. The creator of Jenkins is Kohsuke Kawaguchi. Released under the MIT License, Jenkins is free software.


You now understand fundamentally how Jenkins can run on Kubernetes. Jenkins runs the pipelines while it leverages Kubernetes to schedule the agents and to keep the engine running. Hopefully, you also understand how Kubernetes is a new type of data center operating system that can run your applications - across multiple nodes on your local laptop, a rack of servers, or any cloud target.

Technology stack

This demonstration was performed with these tools. Newer versions may exist.

  • Kubernetes
  • Kubectl
  • Helm
  • Prometheus Operator
  • Kube-Prometheus (Alertmanager + Grafana)
  • Python
  • See jenkins-value.yaml file for Jenkins version and its plugins




No Fluff Just Stuff

For a deeper understanding of these topics and more join me, Jonathan Johnson, for a transcendent experience on the No Fluff Just Stuff Software Symposium Tour.


Step 1 of 5

Your Kubernetes Cluster

As you see, your Kubernetes cluster is started. Verify it's ready for your use.

kubectl version && kubectl cluster-info && kubectl get nodes

Verify the Kubernetes cluster is empty.

kubectl get deployments,pods,services

The Helm package manager used for installing applications on Kubernetes is also available.

helm version

Kubernetes Dashboard

As an administrator, you can control the cluster with the kubectl CLI tool. You can also use the Kubernetes Dashboard. Because the dashboard can be accessed publicly, it is protected and requires the secret access token to sign in. Because you have administration access to this cluster, copy the token from this secret.

export TOKEN=$(kubectl describe secret $(kubectl get secret | awk '/^dashboard-token-/{print $1}') | awk '$1=="token:"{print $2}') && echo -e "\n--- Copy and paste this token for dashboard access --\n$TOKEN\n---"

To access the dashboard, click on the Kubernetes Dashboard tab above the command line or from this link: https://[[HOST_SUBDOMAIN]]-30000-[[KATACODA_HOST]].environments.katacoda.com/. At the sign in prompt select Token and paste in the token, you copied a moment ago.

For Kubernetes clusters exposed to the public, always lock administration access including access to the dashboard.

Kubernetes Dashboard
Jenkins Portal