Deploying Google Kubernetes Engine Rolling Updates

30 minutes
  • 5 Learning Objectives

About this Hands-on Lab

Updating your applications is a fact of life, and there are a number of deployment strategies. The rolling update is one of the most common because it allows an update to take place with zero downtime. In this lab, we’ll create a new Kubernetes Engine cluster and then deploy an existing containerized app via a YAML configuration file. Then, we’ll initiate an update and review the Kubernetes Engine process.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Clone the repo to retrieve the files.
  1. Activate the Cloud Shell by clicking the icon in the top row.
  2. Clone the GitHub repository:
    git clone https://github.com/linuxacademy/content-gc-essentials
  3. Change directory with the following command:
    cd content-gc-essentials/gke-lab-02
Create the Kubernetes Engine cluster.
  1. In the Cloud Shell, enter the following commands:
    gcloud config set compute/zone us-central1-a
    gcloud container clusters create la-gke-1 –num-nodes=4
  2. Set up Cloud Shell to use kubectl commands for the new cluster:
    gcloud container clusters get-credentials la-gke-1
Deploy the app via a YAML config file.
  1. Open the Cloud Shell Editor by clicking the pencil icon.
  2. Navigate to content-gc-essentials > gke-lab-02, and open the deploy-rolling.yaml file.
  3. Review the file, noting the image parameter.
  4. In the Cloud Shell, enter the following command:
    kubectl create -f deploy-rolling.yaml
  5. Note updating pods in the Workloads section of the console.
  6. Expose the deployment:
    kubectl expose deployment rolling –type=LoadBalancer –name=rolling-service –port=80 –target-port=80
    kubectl get services rolling-service
  7. Confirm the exposed service in the console in the Services section.
  8. Click the endpoint link to review application output.
Initiate rolling update.
  1. In the deploy-rolling.yaml file, change the image parameter to the following value:
    linuxacademycontent/content-gcp-labs:rolling-v2
  2. In the Cloud Shell, enter the following command:
    kubectl apply -f deploy-rolling.yaml
  3. On the console Workloads page, click the deployment name.
  4. Review the number of pods, and refresh the page until four pods are shown.
  5. Go to the browser tab showing the application output, and refresh the page.
Review pods and output.
  1. From the console, visit the Workloads section.
  2. Click the existing workload.
  3. View the number of pods created.
  4. In a moment, refresh the page.
  5. Copy the External URL link, and paste it in a new browser tab.

Additional Resources

The app team is moving rapidly, and you’ll need to get their first version of the app deployed to a Kubernetes Engine cluster as soon as possible. Before you know it, they’ll have the next version ready to go, and you must make sure there’s no downtime when you deploy the upgrade. The best way to handle this is with a rolling update.

You’ll need to accomplish the following steps to complete your task:

  1. Clone the repo to retrieve lab files.
  2. Create the GKE cluster.
  3. Deploy the app via a YAML config file.
  4. Revise the YAML file to initiate update.
  5. Confirm the update.

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!