In a modern software development environment, continuous integration and continuous delivery (CI/CD) are central to shipping reliable software quickly. Kubernetes and Docker support this model well: their ability to rapidly create, scale, and terminate containers maps naturally onto the short-lived environments that CI/CD pipelines require.
This article explains how to implement CI/CD in Kubernetes using two complementary tools: Fabric8 and Jenkins. Another tool sometimes used for this purpose is Gulp, but it is out of scope here.
Why CI/CD and Kubernetes Are a Natural Fit
CI/CD requires environments that can be provisioned and torn down on demand for every code change. Kubernetes provides exactly that: declarative workload definitions, fast container scheduling, and namespace-level isolation make it straightforward to spin up ephemeral build, test, and staging environments without manual intervention.
The main challenges developers face when adopting CI/CD on Kubernetes are the number of microservices to orchestrate and the pace of change in the container ecosystem. Purpose-built platforms such as Fabric8 and Jenkins with the Kubernetes plugin reduce this complexity.
Fabric8: An Open-Source CI/CD Platform for Kubernetes
Fabric8 is an open-source developer platform designed to run on top of Kubernetes, OpenShift, and Google Container Engine. It provides an integrated environment for building, testing, and deploying microservices and manages the full CD pipeline lifecycle.
Key Fabric8 Features
- Web-based developer console — create, edit, deploy, and test microservices from a browser.
- Centralised management tooling — aggregated logging, metrics collection, and Java container management.
- Integration and API support — Apache Camel integration, RESTful and SOAP API visualisation and management.
- Java developer tools — Maven plugins and Java libraries that expose Kubernetes APIs in a developer-friendly way.
- CD pipeline management — tooling to define, run, and monitor continuous delivery pipelines.
Setting Up a Local Cluster with gofabric8
The gofabric8 CLI tool bootstraps a Fabric8 environment on top of a local Kubernetes cluster (via Minikube). On Linux, the KVM hypervisor driver is required before starting.
Step 1 — Install the KVM Driver
# Download the KVM driver binary
sudo curl -L https://github.com/dhiltgen/docker-machine-kvm/releases/download/v0.7.0/docker-machine-driver-kvm \
-o /usr/local/bin/docker-machine-driver-kvm
# Make it executable
sudo chmod +x /usr/local/bin/docker-machine-driver-kvm
# Install required KVM packages (Debian/Ubuntu)
sudo apt install libvirt-bin qemu-kvmCode language: PHP (php)
Step 2 — Install gofabric8
curl -sS https://get.fabric8.io/download.txt | bashCode language: JavaScript (javascript)
After installation, add the gofabric8 binary to your PATH by appending the export line to ~/.bashrc (or ~/.bash_profile), then reload the file:
export PATH=$PATH:$HOME/.fabric8/bin
source ~/.bashrcCode language: PHP (php)
Step 3 — Start the Local Cluster
gofabric8 start
This command downloads any required tooling and starts a single-node Kubernetes cluster locally. Once the cluster is running, open the Fabric8 browser console with:
gofabric8 consoleCode language: JavaScript (javascript)
Deploying a Fabric8 Cluster in the Cloud with Stackpoint
For production or shared development environments, running the cluster in a public cloud is more practical. Stackpoint.io (now part of NetApp Kubernetes Service) provides a managed Kubernetes provisioning service that supports Amazon Web Services, Google Cloud Platform, and Microsoft Azure.
Provisioning a GCE-Backed Cluster
- Log in to your Stackpoint account and select Add Cluster.
- Choose Google Compute Engine as the provider.
- In the GCE console (
console.cloud.google.com), create a new project, then navigate to APIs & Services → Credentials → Service Account Key to generate a JSON key file. - Paste the JSON key into the credentials field on Stackpoint and click Create.
- Provide a cluster name and any required customisations, then click Submit.
- Wait for the cluster build to complete (status will update in the Stackpoint dashboard).
Connecting kubectl to the New Cluster
Download the kubeconfig file from Stackpoint, then configure kubectl to use it:
export KUBECONFIG=~/Downloads/kubeconfig
kubectl config use-context stackpointCode language: JavaScript (javascript)
Verify the cluster nodes are visible:
kubectl get nodesCode language: JavaScript (javascript)
Implementing CI/CD with Jenkins on Kubernetes
Jenkins remains one of the most widely used CI/CD servers. A community-maintained Docker image (csanchez/jenkins-kubernetes) packages Jenkins together with the Kubernetes plugin, making it straightforward to run Jenkins inside Docker and connect it to a Kubernetes cluster.
Step 1 — Pull the Image and Create a Data Container
# Pull the Jenkins Kubernetes image
sudo docker pull csanchez/jenkins-kubernetes
# Create a named container to hold Jenkins data
sudo docker create --name jenkins-k8s csanchez/jenkins-kubernetesCode language: PHP (php)
Step 2 — Run Jenkins Using the Data Container
sudo docker run \
--volumes-from jenkins-k8s \
-p 8080:8080 \
-p 50000:50000 \
-v /var/jenkins_home \
csanchez/jenkins-kubernetesCode language: JavaScript (javascript)
Port 8080 exposes the Jenkins web UI; port 50000 is used by Jenkins agents (JNLP). Jenkins data is persisted in the jenkins-k8s container volume, so it survives container restarts.
Step 3 — Initial Jenkins Configuration
- Navigate to
http://localhost:8080in your browser. - Log in as
adminusing the initial password printed in the container startup log. - Choose to install the recommended plugins or select plugins manually. Allow the installation to complete.
- Create your first admin user by providing a username, password, and email address.
Step 4 — Configure the Kubernetes Plugin
The Kubernetes plugin enables Jenkins to dynamically provision build agents as Kubernetes pods, freeing you from maintaining static build servers.
- In Jenkins, go to Manage Jenkins → Configure System.
- Scroll to the Cloud section and click Add a new cloud → Kubernetes.
- Fill in the Kubernetes API URL, namespace, and credentials appropriate for your environment.
- Click Test Connection to verify Jenkins can reach the cluster, then click Save.
When you need Jenkins agents, a JNLP slave image is available on Docker Hub. The Kubernetes plugin will spin up a pod using this image on demand and tear it down once the build completes.
Choosing Between Fabric8 and Jenkins
Fabric8 and Jenkins are complementary rather than competing tools. Fabric8 provides an opinionated, integrated platform with a browser console and pre-built CD pipeline support, making it a good fit for teams that want a complete out-of-the-box experience on Kubernetes. Jenkins offers maximum flexibility through its plugin ecosystem and is appropriate when you need fine-grained control over pipeline logic or need to integrate with existing infrastructure.
In practice, many teams run Jenkins inside a Fabric8 environment, using Fabric8’s developer console for visibility and lifecycle management while Jenkins drives the actual build and test execution.
Summary
- Kubernetes’ container lifecycle features align well with the ephemeral environment requirements of CI/CD pipelines.
- Fabric8 provides a complete open-source platform for managing microservice CI/CD on Kubernetes, OpenShift, and GKE.
- gofabric8 bootstraps a local Fabric8 cluster with a single command; cloud clusters can be provisioned via Stackpoint.
- Jenkins with the Kubernetes plugin enables dynamic, pod-based build agents and integrates with existing Jenkins pipelines.
- The two tools are complementary and are often used together in the same environment.