Finally , I completed Task 6 of DevOps AL- DEPLOYING & MANAGING WEBSERVER USING JENKINS WITH GROOVY, KUBERNETES & DOCKER , under the mentorship of Vimal Daga Sir.
Perform third task with the help of Jenkins coding file ( called as jenkinsfile approach ) and perform the with following phases:
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
- create a folder , then config file , then Dockerfile …..
2. Now , Push this image to Docker Hub …
3. Now , create a deployment code to launch Jenkins-Kubernetes container ….
then Run this command ….
kubectl create -f deploy.yml
4. Now access jenkins using ip:port no. and then create your account .
Use the initialAdminPassword to Unlock Jenkins:
Also install some special plugins like Git , Build Pipeline , job Dsl ,Post Build Script , Email Extention .
5. Created a deployment code that launches a deployment of a container that can host the webserver/app , also create one php code file.
6. Created a groovy code for all three jobs .
for job1 :
for job 2:
for job 3:
7. That was full end to end automation triggered by just one manual click.you can upload it on github then Create a SeedJob(here, SeedJob) which will pull the groovy code from the Github, But i wrote all this code in my SeedJob…
When we run this Job , it will authomatically create our three jobs
The three jobs :
job 2 :
job 3 :
That was full end to end automation triggered by just one manual click.
8 . Create a build pipeline ,On successful build of each job this is what pipeline will look like:
Finally , Task is successfully completed !!!!
Thank You !!