Jenkins + Docker + Kubernetes

This is the depiction of integration of jenkins, docker, kubernetes and github.

Jenkins controlling docker and k8s

This is the upgradation of task 2 in which only docker has been used (reference to task 2) whereas in task 3 kubernetes on top of docker which is ultimately a container orchasteration tool has been used.

So here is the description of task 3:-

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.

Step:-1 (creating image with this Dockerfile):-

We can build this image with above command and push this image into dockerhub with the below command:-


Now we can launch pod with this image with kubectl and also pvc will be created so that jenkins data will remain persistent and service resource will also created so that it will be publically available for outer world :-

Now, in browser hit and jenkins portal will be opened and we can login and now further we can create our jobs here:-

Job 1:-

We are using this html-pod.yml file for launching html pod:-

We are using this php-pod.yml file for launching php pod:-

Job 2:-

We are checking whether our website is working or not if not send the email to the developer:-

We can see that both the jobs have successully completed:-

Finally deployed website is:-

Github url:-

Thank You !