DTASK3

DTASK3

DevOps Task 3:

Perform task on top of Kubernetes where we use Kubernetes resources like Pods, ReplicaSet, Deployment, PVC and Service.

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. Job1: Pull the Github repo automatically when some developers push the 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 the app is not working, then send email to the developer with error messages and redeploy the application after code is being edited by the developer

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

Creating Dockerfile for Jenkins

Launching docker with the same image which was created by above dockerfile

Starting Jenkins service and httpd server

Job1:

Pulling files from Github to "data" folder. If files with extension html and php are there then copy it into /var/www/html folder.

Copying configuration file which is present in ".kube" folder, also some certificates from the base system.

Config file which was copied to .kube folder.

No alt text provided for this image


In Jenkins container: PV, PVC, and deployment files there.

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

Job2-a:

This job runs when job1 runs successfully.

If html files are present then check if that file works or not from Jenkins container, if it works fine then from creating Persistent Volume, then claim it with PersistentVolumeClaim. Then, create deployment and then expose it. Lastly. it will send mail if doesn't works fine.

[Here deployment is created because if pod fails, then other one launches automatically.]

No alt text provided for this image

Job2-b:

This job runs when job1 runs successfully.

If php files are present then check if that file works or not from Jenkins container, if it works fine then from creating Persistent Volume, then claim it with PersistentVolumeClaim. Then, create deployment and then expose it. Lastly. it will send mail if doesn't works fine.

No alt text provided for this image

Mail is sent with logs attached with it to developer.

No alt text provided for this image

See PVC is created or not, and deployment is working or not.

To view or add a comment, sign in

More articles by Akarsh Agarwal

  • VGG FACE RECOGNITION

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

  • TASK6

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

    1 Comment
  • TASK 5

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

    1 Comment
  • TASK4

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

    1 Comment
  • DEPLOYING OWNCLOUD AND MYSQL OVER EKS

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

  • TEAM_VISION

    💐If you are thinking like Why Vision? Its not because of its definition which you when search on wikipedia viz. the…

Explore content categories