Canary Deployments with Kubernetes and Jenkins

1 hour
  • 2 Learning Objectives

About this Hands-on Lab

Canary deployments are a great way to achieve greater stability when doing continuous deployments. By testing changes in a live environment with real users, you can deploy with greater confidence while minimizing the impact of bugs and issues on your users. In this learning activity, you will implement a simple canary deployment to a Kubernetes Cluster as part of a Jenkins Pipeline.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Set up the project and Jenkins and run an initial deployment.

To this, you will need to perform the following steps:

  1. Fork the sample source code repo: https://github.com/linuxacademy/cicd-pipeline-train-schedule-canary.
  2. Change the DOCKER_IMAGE_NAME at the top of the Jenkinsfile to use your docker hub username instead of willbla.
  3. Log in to the Jenkins server.
  4. Set up the credentials in Jenkins (GitHub access token, Docker Hub, and Kubeconfig).
  5. Create a project and build it from your fork.
Add a canary stage to the pipeline and run a successful deployment.

To complete this, you will need to do the following:

  1. Create a deployment template for the canary deployment with a "canary" track.
  2. Add a canary stage to the Jenkinsfile to perform the canary deployment.
  3. Modify the production deploy stage to clean up the canary deployment after production deployment is approved.
  4. Execute the deployment in Jenkins.

Don’t hesitate to Refer to the example-solution branch of the sample source code repo for an example of how to do this!

Additional Resources

Your team has been working hard on their train-schedule application. However, some recent deployments introduced bugs that did not become visible until after the changes were in the hands of real users. To mitigate these kinds of issues, the team has asked you to implement a canary deployment as part of the larger deployment pipeline.

The application runs on Kubernetes cluster, and the team is using a Jenkins pipeline to perform CI and deployments. You will need to add logic to this existing pipeline in order to implement the canary deployment.

You will need to create a fork of the sample course code here: https://github.com/linuxacademy/cicd-pipeline-train-schedule-canary

Be sure to check out the example-solution branch for an example of the code changes needed to implement the canary deployment.

Set Up the project and Jenkins and run an initial deployment:

  • Fork the sample source code repo.
  • Change the DOCKER_IMAGE_NAME at the top of the Jenkinsfile to use your docker hub username instead of willbla.
  • Log in to the Jenkins server.
  • Setup credentials in Jenkins.
  • Create a project and build it from your fork.

Add a canary stage to the pipeline and run a successful deployment:

  • Create a deployment template for the canary deployment with a "canary" track.
  • Add a canary stage to the Jenkinsfile to perform the canary deployment.
  • Modify the production deploy stage to clean up the canary deployment after production deployment is approved.
  • Execute the deployment in Jenkins.

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!