Jenkins Pipelines provides a powerful way to implement a continuous delivery process, and Kubernetes provides incredible benefits in the management and orchestration of containers. In this learning activity, you will learn how to leverage both of these technologies together. You will integrate a Jenkins pipeline with Kubernetes orchestration by deploying to Kubernetes as part of a Jenkins pipeline.
Successfully complete this lab by achieving the following learning objectives:
- Set up the train-schedule project in Jenkins and successfully build it.
- Fork the GitHub repo at: https://github.com/linuxacademy/cicd-pipeline-train-schedule-kubernetes.
- Add GitHub Credentials in Jenkins.
- Add Docker Hub Credentials in Jenkins.
- Add the Kubeconfig from the Kubernetes master as a credential in Jenkins. You can find the kubeconfig file on the Kubernetes master at
- Create a Jenkins project called
train-scheduleand successfully run the build from your GitHub fork.
- Successfully deploy the train-schedule app to the Kubernetes cluster via the Jenkins pipeline.
- Create a Kubernetes template file defining a Service and Deployment for the app. Here is an example: https://github.com/linuxacademy/cicd-pipeline-train-schedule-kubernetes/blob/example-solution/train-schedule-kube.yml
- Add a stage to the Jenkinsfile to perform the deployment to the Kubernetes cluster. Check out an example here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-kubernetes/blob/example-solution/Jenkinsfile
- Run the build and successfully deploy the app to the cluster.
- Verify everything is working by accessing the app in your browser at
http://<Kubernetes node IP>:8080.