Installing Jenkins X on IBM Cloud Kubernetes Service

By: Ram Vennam

Introducing the Jenkins X open source project

The Jenkins X open source project is a continuous delivery solution that was designed and configured especially for Kubernetes. It comes with a simple installer tool that provides a turn-key install when pointed at a Kubernetes cluster, and it supports multiple Kubernetes environments with custom configurations for each.

IBM Cloud has a built-in, hosted Continuous Delivery toolchain that can be used for automating the building and deployment of applications. However, we know our customers sometimes like to use custom solutions, especially when building multi-cloud environments.

Jenkins X comes with regular Jenkins and additional components which are pre-wired together to provide an opinionated, out-of-the-box CI/CD for cloud-native applications on Kubernetes. These additional components include Nexus for caching build artifacts and chartmuseum for Helm chart repository. It also comes with Build Packs for creating quick-start applications and generating Dockerfile, Jenkinsfile, and Helm charts for existing applications. As a result, the CI/CD experience is seamless. It’s worth mentioning that IBM Cloud Developer Tools CLI provides similar functionality.

In this blog, I’ll show you the installation steps to get Jenkins X running on IBM Cloud Kubernetes Service.

Installing Jenkins X on IBM Cloud Kubernetes Service

  1. Install Jenkins-X and Helm.

  2. Use the Jenkins X CLI to create a new cluster on IBM Cloud Kubernetes Service. This command invokes the ibmcloud cli to log in, create a cluster, install, required local dependencies, and provision the Jenkins X platform. I recommend choosing a Standard cluster with at least 4 Core X 16GB with 3 nodes for optimal performance. Note: Choose Kubernetes Version 1.10.

    jx create cluster iks

jx create cluster iks

Stand up and stretch your legs for a few minutes. The installer creates several deployments, persistent volumes, services, and ingress. After your break to stretch, set your KUBECONFIG to your new cluster and run kubectl get deployments,services,pvc,pv,ingress -n jx to see everything that got installed. Note that there are additional charges that are incurred due to the persistent volumes.

The installer creates several deployments

After installation, run jx console to launch the console. Verify that you can log into Jenkins using the provided URL and admin password.

jx console

Configure Jenkins X to use IBM Cloud Container Registry

If you used the jx create cluster iks method described above, the cluster and Jenkins X installation are already configured to use the IBM Cloud Container Registry to store your container images.

All done with the setup! Now for the fun part

Back in the terminal, use jx create quickstart to create a project.

use jx create quickstart to create a project.

This will create a new git repository in your GitHub org with the starter source code, a Jenkins pipeline, and a github webhook to automatically pick up any code changes. On code commits, the build checks out the source code from GitHub, builds the app, creates a Docker image, stores the image in the container registry, and then uses the Helm chart in the repo to deploy the application to your cluster.

Note: Due to a current limitation, your IBM Cloud Container registry namespace (ibmcloud cr namespaces) has to match your github org name. If they do not match, create a new namespace using ibmcloud cr namespace-add <your-github-org>.

create a new namespace using ibmcloud cr namespace-add <your-github-org>.

mynodehttp

Make code changes

Make code changes in your git repository and watch for a new pipeline and an updated application. This gives you a great starting point and is ready for you to modify it to match your requirements.

I hope this post gave you a quick overview of what Jenkins X is and how you can use it with IBM Cloud Kubernetes Service. To learn more, I recommend watching the presentation from KubeCon 2018.

If you have trouble

For questions regarding the IBM Cloud Kubernetes service, engage our team via Slack by registering here. Join the discussion in the #questions channel on https://ibm-container-service.slack.com.

Be the first to hear about news, product updates, and innovation from IBM Cloud