Task 4 of Devops AL

No alt text provided for this image

Create A dynamic Jenkins cluster and perform task-3 using the dynamic Jenkins cluster.

Steps to proceed as:


1. Create container image that’s has Linux and other basic configuration required to run Slave for Jenkins. ( example here we require kubectl to be configured )

2. When we launch the job it should automatically starts job on slave based on the label provided for dynamic approach.

3. Create a job chain of job1 & job2 using build pipeline plugin in Jenkins 

4. Job1 : Pull the Github repo automatically when some developers push repo to Github and perform the following operations as:

  1. Create the new image dynamically for the application and copy the application code into that corresponding docker image

  2. Push that image to the docker hub (Public repository) 

 ( Github code contain the application code and Dockerfile to create a new image )

5. Job2 ( Should be run on the dynamic slave of Jenkins configured with Kubernetes kubectl command): Launch the application on the top of Kubernetes cluster performing following operations:

  1. If launching first time then create a deployment of the pod using the image created in the previous job. Else if deployment already exists then do rollout of the existing pod making zero downtime for the user.

  2. If Application created first time, then Expose the application. Else don’t expose it.

Tools Used:

  1. Windows as base operating system
  2. Jenkins as CI/CD tool .
  3. GitHub as SCM.
  4. Windows system as developer machine.
  5. Red Hat 8 system as server running Docker as Containerize technology.
  6. Pre-configured kubernetes single node cluster, Minikube

So let's start with configuring dynamic slave in jenkins,

  1. Go to Manage jenkins in Jenkins Dashboard.
  2. Select Configure clouds.
No alt text provided for this image

3. Select Docker cloud, remember you need to install docker cloud plugin for this

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Notice , we've restricted this job to run only over our slave and also run after Git_Pull job. so that we can run our web-server with code,as we've create image in previous job.

yaml file used to generate environment:

No alt text provided for this image
No alt text provided for this image

thank you for reading


To view or add a comment, sign in

More articles by Anjali Saini

  • Task4 of mlops

    Problem Statement: Create a project using transfer learning solving various problems like Face Recognition, Image…

  • Task 2 of mlops/Devops

    Problem Statement : 1. Create container image that’s has Python3 and Keras or numpy installed using dockerfile 2.

  • Mlops / Devops task 1

    OBJECTIVE:- JOB1:-If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker…

  • Task 6 of devops AL

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

Explore content categories