CI/CD For Cloud Native Applications On Kubernetes: Whitepaper
CI/CD For Cloud Native Applications On Kubernetes: Whitepaper
6 EASES SETUP
10 PROMOTES AUDITABILITY
To address this gap, many products became available over the last decade in the continuous delivery market
to respond to how software developers can build, configure, deploy, test and monitor their software. They
solved bits and pieces of the larger puzzle, and expected the customer to assemble those pieces into a
robust pipeline that satisfied their use cases. This assembly required deep and specialized knowledge of the
continuous paradigm and customers had to make frequent trade offs between developing the product and
getting entangled in shipping the product. The need for process-as-code, infrastructure-as-code and pipeline-
as-code became even more crucial.
Around the same time, strong undercurrents emerged in other related industries like cloud, cloud native
applications, microservices architecture and container orchestration. All of these technologies are
instrumental in product releases, and these markets are now tied at their hips for success within the
continuous pipeline model. Amazon Web Services, Microsoft Azure and Google Cloud emerged as leading
cloud providers, and Kubernetes emerged as a leader in the container orchestration space. Kubernetes can
be complex for organizations to setup and manage and so leading cloud providers started to offer managed
Kubernetes solutions on their cloud to eliminate the complexity and lower the total cost of ownership.
In this heavily fragmented market, CloudBees stepped up to power the continuous economy and is building
an end-to-end continuous delivery system. CloudBees is a major contributor of Jenkins X, an OSS CI/CD
solution for modern cloud applications on Kubernetes. Jenkins X is a subproject of the Jenkins foundation,
another OSS solution with more than 80% of total contributions coming from CloudBees.
This whitepaper goes into the details about the pillars of continuous everything and how Jenkins X automates
these pillars in an opinionated fashion.
Continuous Everything
CONTINUOUS CONTINUOUS CONTINUOUS CONTINUOUS
INTEGRATION TESTING DELIVERY DEPLOYMENT
Here are brief descriptions of each pillar so that readers can understand that continuous everything is
a journey and not a destination. As they traverse through this paper, they will be able to appreciate the
business value of having these pillars automated for them.
» Continuous integration (CI): Teams integrate early and often to detect issues earlier in the cycle.
This directly translates to lower cost of execution.
» Continuous testing: Automated tests integrate with pipelines and factor into decisions involving
promoting code and artifacts from one pipeline stage to the next.
» Continuous delivery (CD): Products are ready to be released from a source control repository to
production in an automated fashion with one or more manual gates.
» Continuous deployment (CD): Release products from source control to production with no
manual gates.
The risk of a defect during the software development and delivery process is:
Jenkins X comes with all the automation capabilities needed so you can focus on your application code. It
automates your CI/CD needs on Kubernetes including:
» Automatic releases with semantic versions, creation of artifacts, Docker images, and helm charts
» Automatic promotion of versioned artifacts across your environments via GitOps
» Preview environments created on each pull request
Let’s look at the following benefits that Jenkins X brings to organizations practicing continuous everything.
To create a new Kubernetes cluster on Google Cloud, use the command “jx create
cluster gke” from the getting started guide. For those of you who have tinkered
with Kubernetes, you will appreciate the managed Kubernetes services from
the cloud providers. Jenkins X leverages these managed services and performs
a lot of nitty-gritty details behind the scenes to simplify the workload of teams
implementing continuous everything.
More importantly, you can clearly see the naval flavor on the Jenkins butler, who
is fondly called “Captain Kubernetes”!
“A chain is only as strong as its weakest link” might be a cliché, but it holds true when it comes to defining
organizations and teams. Think of the organization as the chain. If high-performing teams in the organization
can move only as fast as the other teams, it might cause them to get frustrated and disengaged. Jenkins X
enables teams to move at their own pace.
We often preach about the need for purposeful (not suicidal) speed without articulating exactly how that’s
done. Jenkins X takes an objective approach by creating assets you would otherwise have to manually
create, which expedites development, testing and delivery.
On each pull request, a CI pipeline is triggered to build your application and run all
the tests. This keeps the master branch in a releasable state.
You could choose a different cloud of course, like Amazon Web Services (AWS) or Microsoft Azure, for
instance. Provide the appropriate parameter to “jx create cluster” for that cloud provider as seen in the
examples below:
Organizations attempt to measure productivity to enhance it. The following are classic ways to generate
automated infrastructure-as-code. Jenkins X does this right out of the box.
Authoring immutable infrastructure can take some time, and time is money. Teams will appreciate that
application containerization is automated in Jenkins X for applications that generate images. The Dockerfile is
auto-generated.
They say “There ain’t no such thing as a free lunch”. Well, in Jenkins X, not only do you get the lunch for free,
you get the lunch box (the Docker container) as well.
From the command line, you can use ‘“jx open jenkins” or “jx console” to open the Jenkins UI in a browser. In
the screenshot below, five runs of the pipeline have happened with numbers 1, 4 and 5 succeeding.
Another term thrown around in the continuous everything world is “predictability”. Vendors market
pipelines as tools that make releases predictable, without understanding how it happens. Jenkins X
does exponentially better than its competition by not just providing the following features, but also by
automating these with simple command line options.
Promotes Auditability
Git is the single source of truth in the Jenkins X world. Audit trails are available in Git, thanks to GitOps
being the norm. Everything is versioned, and hence production outages can be debugged with ease.
GITOPS
Sharing is not always caring - teams step on each others’ toes when they share static environments. GitOps
enables teams to define their environments in an inexpensive and scalable fashion. Jenkins X uses GitOps to
manage configurations for environments and applications, and also application versions.
Two environments – staging and production – are created by default as Git repos, and they do not (and
should not) share resources. Code promotion happens:
» Automatically to staging
» Manually to production using the “jx promote...” command
The number of environments and their names are configurable with the “jx create environment” and “jx
edit environment”, although we recommend you take a minimalist approach. As far as environments are
concerned, the less the merrier, since each additional environment adds to maintenance overhead.
The presence of one (or more) manual gate(s) is in fact the primary difference between continuous delivery
and continuous deployment. Some organizations do not allow headless end-to-end runs all the way to
production. To remove all manual gates, you may have to wade through both technical challenges and
political power plays. Jenkins X makes these configurable and you can remove the manual gate(s) when you
have built in the organizational discipline.
Successful businesses not only just deliver the goods, but they can do so consistently for years and
decades. These businesses run as marathons, not sprints, since sustainability is a key part of their strategy.
Jenkins X takes automation to the next level and prevents burn-out among software developers, quality
assurance, release engineers and others who would otherwise have to do this manually. And, it introduces
techniques to experiment with new ideas without inflating the budget. Here’s how.
EASES ROLLBACKS
Jenkins X reduces shelf time of new features and improves “Time-to-Market” without burning out team
members. Teams can:
Although continuous delivery advocates for roll forward only, the capability to rollback is essential,
although you may choose to not use it. In Jenkins X and GitOps, application versions are Git tags. Releases
are done from the master branch, and you can see the release versions under the Release Tab in GitHub. If
you choose to, you can revert to the last known good version easily with the “jx promote…” command.
Jenkins commands the lion’s share of the market in the world of pipelines. According to community stats,
Jenkins sites report their usage to the Jenkins project which runs over 19 million jobs every month. Every
small, medium and large company banks on the fact that most or almost all developer new hires come
“equipped” with Jenkins knowledge. That radically reduces a key business metric “Time-to-Code” – which
is the time taken for a new hire to build, configure, deploy, test and release their first lines of code to
production.
The plethora of technologies and concepts and how they interact can be intimidating in the beginning...
» GitOps
» Google Cloud
» Microsoft Azure
...and hence the automated CI/CD solution helps you focus on writing quality and secure applications
instead of burning the midnight oil on infrastructure.
Jenkins X gets you started at the speed of light, however, the onus lies on you to gradually and eventually
learn these underlying details. While we are sure you are well on your way to design and implement resilient
pipelines, we wanted to make sure you have these details at your fingertips. Here is a quick overview on
some of those “undercover agents”, so that you can seamlessly continue on your journey in the continuous
everything paradigm.
ChartMuseum
Jenkins X
Cloud
Jenkins
JX
Jenkins X introduces the “jx” command line - a single command to rule them all. You can either:
For example, the Google Cloud shell comes with most of the tools you will need like Git, gcloud, kubectl etc,
and is the recommended option.
» “jx create cluster gke” creates a new Kubernetes cluster on Google Cloud
» “jx create quickstart” creates a new app and imports the generated code into Git and Jenkins for CI/CD
» “jx open jenkins” opens Jenkins in a browser
You can type “jx help” to find the various operations you can perform in Jenkins X.
HELM
Helm charts manage Kubernetes applications in a predictable and repeatable fashion. This enables them to:
The Helm charts are versioned in source control, and can be audited. They are also easy to create and publish
and reduce communication overhead. Finally, Helm charts make rollbacks to the last known good version
stress-free (and drama-free).
CHARTMUSEUM
You need to understand what a chart repository is first before learning about ChartMuseum.
A chart repository is an HTTP server that houses an “index.yaml” file and optionally some packaged charts.
The repository is also a location where packaged charts can be stored and shared.
ChartMuseum is an open-source Helm chart repository written in Go. It is compatible with cloud storage
backends like:
» Amazon S3
» Installation
» Configuration
SKAFFOLD
Skaffold is a command line tool that facilitates CD for Kubernetes applications. It can iterate on your
application source code locally then deploy to local or remote Kubernetes clusters. Skaffold also handles
the workflow for building and deploying your application, and leverages that workflow in an automated
pipeline to promote applications from development and testing phases to staging to production.
JENKINS
Jenkins is an open source automation tool that is a self-contained Java-based program used as a simple CI
server or turned into a continuous delivery hub. The tool has a plug-in ecosystem to support the building,
testing and deployment of any project.
The tool supports a “Jenkinsfile” that leverages pipeline-as-code syntax or DSL (domain-specific language)
in two formats:
» Scripted syntax
» Standardize and automate the way we build, manage, and secure applications using containers
» Create a model for better collaboration and innovation with QA, release, operations, security and
other related functions
KUBERNETES
Kubernetes runs production workloads at Google, which translates to running billions of containers per
week. Among many other things, Kubernetes:
KSYNC
Ksync syncs files between our local file system and a Kubernetes cluster. The tool transparently updates
containers running on the cluster from your local checkout. Ksync also enables developers to use their
favorite IDEs (integrated development environment) to work from inside a cluster instead of outside it.
“jx sync” syncs files between our local file system to the devpods on the Kubernetes cluster. This prevents
typical problems like “works on my machine” from slowing down business, and lets everyone channel their
energy into supporting the customer.
The Google Cloud SDK provides the command line interface for Google Cloud Platform products and
services, like:
» Gcloud, which manages authentications, local configurations, developer workflow and interactions
» Kubectl, which orchestrates the deployment and management of Kubernetes container clusters
on gcloud
The Jenkins X community is growing rapidly and the project is moving fast. As we add new capabilities
and techniques to Jenkins X, we’ll make sure to let you know through the CloudBees blog and on Twitter
@cloudbees. You can also stay current on Jenkins X news or follow @jenkinsxio on Twitter too.
Try out Jenkins X and help shape its future. Let us know what issues you face. Pipeline is no longer a pipe
dream – so, happy coding.
CloudBees, Inc.
2001 Gateway Place, Suite 670W | San Jose, CA 95110 | United States
www.cloudbees.com | [email protected]
The registered trademark Jenkins® is used pursuant to a sublicense from the Jenkins project and Software in the Public Interest, Inc. Read more at: www.cloudbees.com/jenkins/about