Task 6 of devops AL

No alt text provided for this image

1. 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. Job2 ( Seed Job ) : Pull the Github repo automatically when some developers push repo to Github.

5. Further on jobs should be pipeline using written code using Groovy language by the developer

6. Job1 :

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 using PVC ( If server collects some data like logs, other user information )

7. Job3 : Test your app if it is working or not.

8. 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:

  1. Seed Job: This job is configured with a github-webhook. It will download the groovy script pushed by developers and create jobs according to the script and views it as required by the operations team.
  2. The 3 jobs will be automatically created as we have configured it in the groovy script and they are as follows :
  • Job1: Download and interpret the code from Github, build the image using given Dockerfile and push it to Dockerhub.
  • Job2: Deploy and expose your webserver on Kubernetes so testing can be performed accordingly.
  • Job3: Send status to the team as per the result of the build and deployment status.
  • Before we move forward these Plugins are required to be installed:
  1. Job DSL
  2. Script Security Plugin
  3. GitHub plugin
  4. Workspace Cleanup Plugin (to clean workspace before every build)
  5. CloudBees Docker Build and Publish plugin
  6. Email Extension Plugin
  7. Build Pipeline Plugin

The Seed Job: this will download the groovy script file from the GitHub and it will run the file.

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
No alt text provided for this image
No alt text provided for this image

now in job2 kubernetes will fetch this image from the dockerhub and use it to create pods and launch the website created by the developer in it and expose it so the it is accessible from anywhere.

Now if you check the pods created by the kubernetes…

# kubectl get all

now if you will check http://<minikube ip>:<exposed port>

you can see the sample website launched through the kubernetes.

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 4 of Devops AL

    Create A dynamic Jenkins cluster and perform task-3 using the dynamic Jenkins cluster. Steps to proceed as: 1.

Others also viewed

Explore content categories