Your submission was sent successfully! Close

Kubernetes CI/CD pipelines: What, why, and how

Alex Chalkias

on 7 September 2021

Who is this for?

This blog can provide you with useful information on how to set up a Kubernetes CI/CD workflow using state-of-the-art of open source DevOps tools, whether you are:

  • A developer at the start of your journey with enterprise software
  • An experienced software engineer working on your company’s applications, or 
  • An engineering lead trying to improve your team’s productivity

What is a CI/CD pipeline?

Traditional software development methodologies typically require a person, e.g. a Product Manager, to decide on and describe the desired behaviour of the software. The next step is for the development team to write, build, unit test and version-control the code using a revision management system, usually Git. Finally, test engineers validate the new software against a test suite that is designed with the desired behaviour in mind. This entire process has its shortcomings:

  • The completion of every phase relies on the previous one.
  • Troubleshooting code or tests written by different teams can be cumbersome. 
  • Cross-team coordination can amplify delays and trump code quality.

Enter CI/CD, a term often used alongside “DevOps”, “Agile”, “automation” etc. These terms aim to describe a modern development workflow that teams adopt in an attempt to improve quality and productivity. 

A CI/CD pipeline is a series of stages and automated steps software goes through, from code development to production deployment. 

CI stands for ‘Continuous Integration’ and refers to the software build pipeline. CI includes all the steps developers take between writing the code and pushing it to a team testing stage. These steps are designed to help the team capture any issues related to the code quality by providing them with constant feedback through automated builds, smoke tests, unit tests and so on. 

CD refers to the software release pipeline, and can stand for either ‘Continuous Delivery’ or ‘Continuous Deployment’ – two very similar practices, mainly different in their level of automation. CD is all about validating that the code provides the desired functionality by deploying it across a series of environments. These environments aim to replicate the actual production environment, where the software will eventually run, prior to actually deploying it in production.

What is GitLab?

GitLab is a popular DevOps platform for end-to-end development and operations. It provides users with a Git repository for source version control, issue tracking, and CI/CD features. Developers can use the GitLab web UI and API to track builds, track test results, monitor deployments, and schedule batch jobs across various testing environments.

What is Kubernetes? And what is MicroK8s?

Containerisation is the latest trend in cutting-edge software development. Containers allow your software to be environment-agnostic whilst also ensuring consistent behaviour across environments, something often referred to as “cloud native”. Kubernetes is an open-source cloud platform that automates the deployment and operations of cloud native applications at scale. 

Despite all this awesomeness, Kubernetes’s biggest caveat is its high barrier to entry. Kubernetes can be very complicated to set up, it comes with a large tooling ecosystem and requires a lot of configuration and tuning to run containerised applications in the long term. 

Our solution to this is MicroK8s, Canonical’s lightweight & opinionated Kubernetes distribution. Developers and enterprises alike often report that MicroK8s is the right combination of intuitive and robust to address their use case, whether they work on a local workstation or on highly available clusters.

Try MicroK8s now

What are the benefits of Kubernetes CI/CD?

CI/CD workflows and cloud native systems have a few goals in common: they both try to increase development velocity, optimise software quality and maintain its operability. CI/CD automates many steps from when code is developed to the point it is released in production. Similarly, Kubernetes automates container deployments across various infrastructure environments and ensures efficient resource utilisation. Therefore, it naturally makes sense for organisations to set up CI/CD pipelines that leverage the Kubernetes platform.

GitLab is one of the most popular solutions if you are looking to do exactly that. It comes with a built-in container registry and can integrate with Kubernetes in three ways: 

  • Software built in a GitLab CI pipeline can be deployed to Kubernetes as part of the CD stage
  • Kubernetes can manage batch job executions that are linked to a GitLab instance
  • GitLab instances themselves can be run on a Kubernetes cluster

Bringing everything together: MicroK8s CI/CD with GitLab

If you’re sold on CI/CD pipelines on Kubernetes, we have just the thing for you. MicroK8s is the easiest way to get a fully conformant Kubernetes cluster, and GitLab provides you with all the right tools for you to build a full DevOps environment. You only need to get some virtual machines and you and your teams are off to the races.

You can follow our 5-step guide to set the whole thing up on AWS. Note that in this tutorial we are also using the Charmed Operator Framework, with which you can follow the same steps to implement the same setup on any cloud. If you want to follow along, we also have a YouTube tutorial.


If you like our approach and would like to explore how to use it for your day-to-day production workflows, feel free to talk to our experts.

Looking for more details on MicroK8s? Watch on demand the webinar ‘Intro to MicroK8s’.

Watch now ›

Cover photo by EJ Strat on Unsplash

kubernetes logo

What is Kubernetes?

Kubernetes, or K8s for short, is an open source platform pioneered by Google, which started as a simple container orchestration tool but has grown into a platform for deploying, monitoring and managing apps and services across clouds.

Learn more about Kubernetes ›

Newsletter signup

Select topics you're
interested in

In submitting this form, I confirm that I have read and agree to Canonical's Privacy Notice and Privacy Policy.

Related posts

Kubernetes 1.23 rc testing with MicroK8s

Today, Kubernetes 1.23 release candidate was made available upstream for testing and experimentation. General availability is planned for December 7th, so now...

Canonical Presence at KubeCon + CloudNativeCon NA: Keynote by Founder/CEO Mark Shuttleworth, Announcement of Ubuntu 21.10 Beta

Canonical, the makers of Ubuntu, will have a major presence at this year’s KubeCon + CloudNativeCon NA. The Cloud Native Computing Foundation’s flagship...

Portainer and Canonical Expand Partnership Launching Business Charm for Charmed Kubernetes

Auckland, New Zealand – Portainer announced the launch of its Portainer Business Charmed Operator, allowing for seamless integration with Canonical’s Charmed...