Orchestrating Deployments with Jenkins Workflow and Kubernetes

Written by: Tracy Kennedy
3 min read

In a previous series of blogs, we covered how to use Docker with Jenkins to achieve true continuous delivery and improve existing pipelines in Jenkins. While deployments of single Docker containers were supported with this initial integration, the CloudBees team and Jenkins community’s most recent work on Jenkins Workflow will also let administrators launch and configure clustered Docker containers with Kubernetes and the Google Cloud Platform.

What is Workflow?
Jenkins Workflow is a new plugin which allows Jenkins to treat continuous delivery as a first class job type in Jenkins. Workflow allows users to define workflow processes in a single place, avoiding the need to coordinate flows across multiple build jobs. This can be particularly important in complex enterprise environments, where work, releases and dependencies must be coordinated across teams. Workflows are defined as a Groovy script either within a Workflow job or checked into the workspace from an external repository like Git.

Docker for simplicity

In a nutshell, the CloudBees Docker Workflow plugin adds a special entry point named Docker that can be used in any Workflow Groovy script. It offers a number of functions for creating and using Docker images and containers, which in turn can be used to package and deploy applications or as build environments for Jenkins.

Broadly speaking, there are two areas of functionality: using Docker images of your own or created by the worldwide community to simplify build automation; and creating and testing new images. Some projects will need both aspects and you can follow along with a complete project that does use both: see the demonstration guide .

Jenkins Workflow Deployments with Kubernetes

As mentioned in the previous blog, the Google Cloud Platform also supports pushing Docker images to the Google Container Registry and deploying them to the Google Container Engine with Kubernetes.

Jenkins Workflow now also supports using the Google Cloud Platform’s Container Registry as a Docker image registry. Additionally, it also exposes a few new Kubernetes and Google Cloud Platform-specific steps to complement Workflow’s existing Docker features. These steps allow Jenkins to securely connect to a given Kubernetes cluster, as well as remotely instruct the Kubernetes cluster manager to launch a given Docker image as a container in a Kubernetes Pod, change existing settings like the target cluster or context, and set the target number of replicas in a cluster.

Where do I start?

  1. The Workflow plugin is an open-source plugin, so it is available for download from the open-source update center or packaged as part of the CloudBees Jenkins Platform.

  2. The CloudBees Docker Workflow plugin is another open-source plugin available in the OSS update center or as part of the CloudBees Jenkins Platform.

  3. The Google Cloud Registry Auth plugin is an open-source plugin developed by Google, so it available to download from the open source update center or packaged as part of the CloudBees Jenkins Platform.

  4. The Kubernetes plugin is another open-source plugin available from the open-source update center or packaged as part of the CloudBees Jenkins Platform.

  5. The Google Container Engine offers a free trial .

  6. The Google Container Registry is a free service.

  7. Other plugins complement and enhance the ways Docker can be used with Jenkins. Read more about their uses cases in these blogs:

    • Docker Build and Publish Plugin

    • Docker Agents with the CloudBees Jenkins Platform

    • Jenkins Docker Workflow DSL

    • Docker Traceability

    • Docker Hub Trigger Plugin

    • Docker Custom Build Environment plugin

Tracy Kennedy
Associate Product Manager

Tracy Kennedy is an associate product manager for CloudBeesand is based in Richmond. Read more about Tracy in her Meet the Bees blog post and follow her on Twitter.

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.