Deploying to Kubernetes with Jenkins Pipelines

1.5 hours
  • 2 Learning Objectives

About this Hands-on Lab

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.

Learning Objectives

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 /home/cloud_user/.kube/config.
  • Create a Jenkins project called train-schedule and successfully run the build from your GitHub fork.
Successfully deploy the train-schedule app to the Kubernetes cluster via the Jenkins pipeline.

Additional Resources

Your team is working on building out a CI/CD pipeline for their train schedule application. The app has already been Dockerized, and has a Jenkinsfile which is able to build a Docker image of the app and push it to Docker Hub. The team is now ready to begin implementing orchestration with Kubernetes. A basic Kubernetes cluster has already been set up.

You have been asked to implement automated deployment to the Kubernetes cluster in the Jenkins pipeline.

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.
  • Create a Jenkins project called train-schedule and 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.
  • Add a stage to the Jenkinsfile to perform the deployment to the Kubernetes cluster.
  • 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.

Note: You will need both a Docker Hub account and a GitHub account to complete this activity.

If you are unsure how to proceed, feel free to check out the Solution video as well as the example-solution branch of the GitHub repo.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!