CI/CD: Deployment to Kubernetes Cluster

Nikita Volzhin
8 min readJul 21, 2024

Building a Kubernetes cluster is like assembling IKEA furniture, but with more YAML and fewer wrenches

Introduction

This is the second article in the CI/CD series. Last time we briefly talked about CI/CD theory, created a simple Flask app, pushed it to the GitHub registry, set up Jenkins server on AWS EC2 instance, and modified a webhook trigger so that Jenkins runs the CI-part of the pipeline after each push. You can check this article here:

In the current article, we will focus on the delivery part of the pipeline (CD) by setting up the Kubernetes (K8s) cluster on AWS EC2 and adding the K8s deployment phase to our Jenkins pipeline. Graphically, we can depict our desired pipeline in the following scheme:

Scheme of the pipeline, which we started creating in the previous article and which we will finish building in this article

This article consists of practical steps, steps to do after the server restart, possible troubleshooting, and sources (some code here is not mine, I leave the origin at the end)

Practice

NB: Cloud resources for this tutorial do not fall under the AWS free tier. While the…

--

--