Finally I completed Task 3 of DevOps given by Vimal Daga sir .
Integrating Kubernetes with Jenkins using Docker
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 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 app is not working , then send email to developer with error messages and redeploy the application after code is being edited by the developer
steps :
- firstly create a Dockerfile to install jenkins and kubernetes.
2) kubectl should be installed in Linux and configured also.
for configuration , all certificate files should be copied in same folder.
3) then use these commands to create docker image and push to docker hub ….
docker build -t dockerhubid/jen-kube:v1
docker push dockerhubid/jen-kube:v1
4) then create deployment.yml file and use these commands…
kubectl create -f deployment.yml
then jenkins will open ….
5) create repository in github and push code there .
6) Create jobs in jenkins …..
Job1 : Pull the Github repo automatically when some developers push repo to Github.
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 )
Job3 :
Test your app if it is working or not.
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
Final view of the project
install Build pipeline for build pipeline view….
And hence the project is completed !!!