Kubernetes delivery unlocked

The difference between CI and CD for Kubernetes

CI and CD

Software rarely stays unchanged for large periods of time. It's common for the workloads in a Kubernetes cluster to be updated multiple times a day, with deployments rolling out and customers remaining blissfully unaware of the many changes happening beneath the surface. The key to pushing changes to your environments quickly and safely is Continuous Integration (CI) and Continuous Delivery (CD). CI and CD are 2 sides of the same coin. They both exist to make sure your customers get your features quickly and with as few issues as possible.

Continuous Integration

CI was developed to help combat the growing complexity of software development. The concept of CI stems from the need to allow multiple developers to integrate their changes. Without CI, developers work on long-running branches of code, which are often merged close to the end of the project or another large deadline. This leads to "integration hell", where developers suddenly discover merge conflicts, code incompatibilities, and bugs. CI aims to solve these problems by integrating the code frequently, often multiple times a day, with automated tests to ensure the code works together.

CI was born out of necessity for large teams and large codebases, but it's still useful for small teams and projects. A key concept in modern development is a feedback loop. This feedback loop is the time it takes developers to know that there's a bug in their code. Since the human brain can only keep so much information in context, it's valuable to find out about an issue quickly. When an issue gets brought to attention while a developer is still working on the same code section, they'll still have the changes they made at the forefront of their mind. They won't need to read through their changes again to remember what they did (and why). Automated tests are one of the fastest and most comprehensive ways to find a bug in your code. CI lets you run these automated tests quickly and reliably, shortening the feedback loop and keeping your developers productive.

Continuous Delivery

CD takes CI to the next level. CI by itself will only automatically build and test code. Without CD, the code will only get deployed when it has enough changes to warrant a release. This often leads to a large effort to collate the changes and release them all at the same time. CD takes the lessons learned from CI and applies them to deploying.

Kubernetes is the perfect partner for anyone looking to use continuous deployments, both for running your CD pipeline and to abstract difficult concepts away from the underlying implementation more easily. If your code deploys to a Kubernetes cluster running on a local developer machine, it will also likely work in a cloud provider. This lets you keep your pipeline generic, only referencing Kubernetes, while you optimize each environment for its intended use case.

While CI and CD are both important, there's more to consider when it comes to Kubernetes to set you up for success in CD. In the following section, we'll look at some best practices to consider for Kubernetes CD.