Automating Deployment with CI/CD pipeline using Jenkins and the power of Kuberenets
- 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 start the 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.
- Windows as base OS
- RHEL8 in which we run docker
First we import the files ca.crt,client.crt,client.key and config file from the base OS to the folder in which we create Dockerfile in the RHEL8.
We create Dockerfile that has Jenkins and kubectl installed for launching pods on top of kubernetes.
We build the Dockerfile using the below command:
docker build -t task3:v1 .
After successful build the following screen appears
After successful we will launch the container from this image with the following command:
docker run -it --name task3 -p 8083:8080 task3:v1
After successful launching of container we can see that Jenkins got started in the 8083 port and enter the password that is provided at the time of launching the container
This job will copy the code from github into the workspace of job1 inside Jenkins container.
This Job will run the Kubernetes pod with the required interpreter
Use the see the pvc.yml file and pod.yml files code in my Github repository
Contribute to SatyaBhashiniNandigam/devopstask3 development by creating an account on GitHub.
This Job will open the site and if it is not working good then it sends mail to the developer.