In this article, I will demonstrate Continuous Integration & Continuous Deployment using Jenkins, Git, and Kubernetes. Also before begin let’s see a little bit of overview of these three popular technologies.

Jenkins :

Image for post

Jenkins logo

Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build.

Git :

Image for post

Git logo

Git is a distributed version control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

Kubernetes :

Image for post

Kubernetes logo

Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management. It was originally designed by Google and is now maintained by the Cloud Native Computing Foundation. It aims to provide a “platform for automating deployment, scaling, and operations of application containers across clusters of hosts”. It works with a range of container tools, including Docker.

So, Let’s see the Problem Statement :

1. Create a container image that’s has Jenkins installed using Dockerfile Or You can use the Jenkins Server on RHEL 8/7.

2. When we launch this image, it should automatically start the Jenkins service in the container.

3. Create a job chain of job1, job2, job3, and job4 using build pipeline plugin in Jenkins.

4. Job1: Pull the GitHub repo automatically when some developers push the repo to GitHub.

5. Job2 :

I) By looking at the code or program file, Jenkins should automatically start the respective language interpreter installed image container to deploy code on top of Kubernetes ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed )

II) Expose your pod so that the testing team could perform the testing on the pod.

III) Make the data to remain persistent (If the server collects some data like logs, other user information ).

IV) Job 3: Test your app if it is working or not. If the app is not working, then send an email to the developer with error messages and redeploy the application after the code is being edited by the developer.

Pre-requisites :

  • I am using RedHat Enterprise Linux 8 as my base operating system in VirtualBox. You can use any Linux OS to perform this task. In my base OS, I installed two main programs, 1st one is Jenkins and 2nd is Kubectl (Kubernetes Client). I will show you how to set both in a few minutes.
  • Next, I am using Minikube in VirtualBox as a Kubernetes server. For creating a local connectivity in my system I created one host-only adapter and in my system, Windows10, RHEL8, & Minikube are connected with it.
  • Finally, I am using Git in my Windows system to develop the code and to upload it to GitHub.

#git #kubernetes #automation #jenkins #devops

CI/CD Pipeline Using Git, Jenkins & Kubernetes
2.75 GEEK