WebServer on Kubernetes Cluster via Jenkins using Groovy Script
Sandeep Singh Rajawat
Former Business Technology Solutions Associate @ ZS Associate
Jenkins Job list:
1.Seed Job: This job is configured with a github-webhook. It will download the groovy script pushed by developers and create jobs according to the script and views it as required by the operations team.
2. The 3 jobs will be automatically created as we have configured it in the groovy script and they are as follows :
- Job1: Download and interpret the code from Github, build the image using given Dockerfile and push it to Dockerhub.
- Job2: Deploy and expose your webserver on Kubernetes so testing can be performed accordingly.
- Job3: Send status to the team as per the result of the build and deployment status.
The Seed Job: this will download the groovy script file from the GitHub and it will run the file.
go to Manage Jenkins >> Configure Global Security then do the following settings
3 jobs and a build view automatically created by the seed-job
Now, when the job1 is build it will go to the github where the Developer have uploaded the HTML file and Dockerfile copy both the files the linux system. And build a docker image using the Dockerfile and push(upload) the docker inage in the developer's docker repository in www.hub.docker.com .
now in job2 kubernetes will fetch this image from the dockerhub and use it to create pods and launch the website created by the developer in it and expose it so the it is accessible from anywhere.
Now if you check the pods created by the kubernetes.
the pods are launched successfully in the kubernetes and the service is exposed with a random port
the sample website launched through the kubernetes.
Business Technology Solutions Associate Consultant @ ZS Pune
4 年Awesome ??