DEVOPS TASK 4

DEVOPS TASK 4

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.

---------------------------------------------------------------------------------------------------------------

Step 1: Dockerfile of SSH enabled image which has Kubernetes configuration

No alt text provided for this image

Config file used for Kubernetes:

No alt text provided for this image

Step 2: Docker files:

For apache webserver [here tagged and pushed in DockerHub as manaligorwani/apache-webserver-php:latest]

No alt text provided for this image

Docker file which copies the webpages and creates/updates the docker image [here tagged and pushed in DockerHub as manaligorwani/manali-php:latest], that same folder should have webpages to be deployed.

No alt text provided for this image

Step 3: Deployment file which creates pods using above image

No alt text provided for this image

Step 4: In Slave system, update /usr/lib/systemd/system/docker.service file, add "-H tcp://0.0.0.0:4243" in ExecStart variable to expose TCP port

No alt text provided for this image

Step5: Use the slave system's IP as DockerHost in the main system, to access the slave system's docker service from there.

No alt text provided for this image

Step 6: Start Jenkins with main system. Job1 pulls data from Github repository and copies in /web_data folder and that same folder is used to build/publish docker image with the help of slave system's dynamic node which is configured in Jenkins.

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

Step 7: Job2 is restricted to work in slave system's dynamic node

No alt text provided for this image

And this job runs only after successful completion of job1

No alt text provided for this image

Launches the deployment and exposes it.

No alt text provided for this image

Configuration of dynamic node in Jenkins:

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

Now, job1 runs as soon as something is uploaded or changed in the Github repo, and after successful completion of job1, job2 runs and launches deployment

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

When there is any change in Github repository it updates automatically, nothing is to be done manually.

No alt text provided for this image


要查看或添加评论,请登录

Manali Gorwani的更多文章

  • TASK-4: FACE RECOGNITION WITH VGG16

    TASK-4: FACE RECOGNITION WITH VGG16

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

  • DEVOPS TASK 6

    DEVOPS TASK 6

    Perform third task with the help of Jenkins coding file ( called as jenkinsfile approach ) and perform the with…

  • DEVOPS TASK5

    DEVOPS TASK5

    Integrate Prometheus and Grafana and perform in following way: 1. Deploy them as pods on top of Kubernetes by creating…

  • DEVOPS TASK3:KUBERNETES+JENKINS

    DEVOPS TASK3:KUBERNETES+JENKINS

    DevOps Task 3: Perform task on top of Kubernetes where we use Kubernetes resources like Pods, ReplicaSet, Deployment…

  • DEVOPS TASK 2

    DEVOPS TASK 2

    1. Create container image that’s has Jenkins installed using dockerfile 2.

  • DEVOPS-TASK1

    DEVOPS-TASK1

    JOB#1 If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment. JOB#2 If…

  • JOOMLA AND MYSQL SETUP ON AMAZON EKS

    JOOMLA AND MYSQL SETUP ON AMAZON EKS

    Goal: To create an EKS cluster using AWS Deploying Joomla and MySQL on EKS Using EFS for storage Step1: Creating EKS…

  • End to end automation through Terraform

    End to end automation through Terraform

    Task 1 : Have to create/launch Application using Terraform 1. Create the key and security group which allow the port 80.

社区洞察