WebServer on Kubernetes Cluster via Jenkins (Groovy Script approach)
This task has been completely implemented on RHEL 8. It is assumed that Jenkins, Minikube and Kubectl are already set up on your system.
**The kubectl is set up on host OS that will control our minikube. Minikube is available in VM. Host OS and Minikube are on a common network.
Jenkins Job list:
- Seed Job: This job is configured with a webhook. It will download the groovy script pushed by developers and create jobs and views as required by the operations team.
- The created jobs in our case have been specified to us and will be explained in the solution itself.
Plugins required to be installed:
- Job DSL
- Script Security Plugin
- GitHub plugin
- Workspace Cleanup Plugin (to clean workspace before every build)
- CloudBees Docker Build and Publish plugin
- Email Extension Plugin
- Build Pipeline Plugin
GitHub plugin and use of webhooks can be found here :
Automated Web Deployment Setup
Problem Statement - Problem is divided into three main parts: Create a git repository and develop a Jenkins job that…
This a seed kob attached to a webhook. It will run every time a developer pushes an update. Here we are given what these jobs will perform which 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.
This job will not run directly so we need to tweak somethings in the security settings so we don’t face any problems.
Manage Jenkins >> Configure Global Security
This will disable security checks on DSL scripts else on every build you will have to approve the script.
After you build it, you get three new jobs and a new view in Build Pipeline. (Build Pipeline has a known bug, it won’t show the build pipeline until you change its name on every build. It would be created just not visible.)
** The jobs in the view will be visible after you start first build.
The code is available here for your reference.
Contribute to akumar-99/groovy development by creating an account on GitHub.
This is the documentation I referred to write my codes. Refer here for help and if you have any doubts, contact me.
Now after we run the main jobs, here are the outputs on the first deployment and update rollout.
Thanks for giving time. All doubts and suggestion are welcome.