Pipeline

Automation of Git,GitHub,Jenkins & Kubernetes

Ashwani Singh
5 min readJul 16, 2020

--

Integration of CI/CD Tool & Container Orchestration Tool

Git:

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and Clear Case with features like cheap local branching, convenient staging areas, and multiple workflows.

GitHub:

GitHub is a code hosting platform for collaboration and version control.

GitHub lets you (and others) work together on projects.

Jenkins:

Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Jenkins is a CI/CD tool.

Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

Kubernetes:

Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.

It groups containers that make up an application into logical units for easy management and discovery. Kubernetes builds upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.

TASK : Build an Automation

Problem Statement

Create 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 starts 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 repo to Github.
5. Job2 :
1. 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 )
2. Expose your pod so that testing team could perform the testing on the pod
3. Make the data to remain persistent ( If server collects some data like logs, other user information )
6. Job3 : Test your app if it is working or not.
7. Job4 : if app is not working , then send email to developer with error messages and redeploy the application after code is being edited by the developer.

Solution:

STEP1: In this step I had created a conatiner image of CI/CD Tool i.e. Jenkins by using Dockerfile.

Jenkins Image
Admin Password
Admin User
Jenkins Dashboard
Launch Jenkins by Kubernetes Deployment

But in my system I am using my RHEL 8 which has already Jenkins installed & kubectl configured.

Kubectl Configuration

STEP2: Write code in Git & push it to Github repo.

Staging & Commiting Area
Git Push

STEP3: In this step I will create JOB1 & configure it in such a way that it loads the data from GitHub Repo and copy it to my local system.

Job 1 Configuration
Job 1 Configuration
Job 1 Configuration
Job 1 Console Output

STEP4: In this step I will create JOB2 & configure it in such a way that it launches a deployment of the image having php interpreter with that code which developer has pushed to GitHub.

Job 2 Configuration
Job 2 Configuration
Job 2 Console Output

STEP 5: In this step I will create JOB3 & configure it in such a it check that our server is working or deployed or not.

Job 3 Configuration
Job 3 Configuration
Job 3 Configuration
Job 3 Console Output

STEP 6: In this step I will create JOB4 & configure it in such a way that if server is not working it will send an email to the developer .

Job 4 Configuration
Job 4 Configuration
Job 4 Configuration
Job 4 Console Output

STEP 7: In this step we will create a Build Pipeline which shows the workflow on all the jobs.

Build Pipeline

STEP 8: In this step we will see the site only if all the jobs is executed successfully.

Thanks to all viewers.

Your comments & review are valuable for me.

LinkedIn Profile : Click Here

GitHub Repo URL : Click Here

--

--

No responses yet