Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

Performing a Rolling Update of an Application in Kubernetes

In this hands-on lab, you will be presented with a 3-node cluster. You will need to deploy your application, so you can begin serving your end users. You will deploy the image from `linuxacademycontent/kubeserve:v1` and then verify the deployment was successful. Once your application is running and serving clients, you will perform a rolling update, making sure the rollout is successful and there is no downtime for your end users. You will make use of the `kubectl` command-line tool to perform all operations, in combination with the `set image` command to perform the rolling update to the new version. When you have verified the end users are now using version 2 of the app versus version 1, you may consider this hands-on lab complete.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 30m
Published
Clock icon Mar 31, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create and Roll Out Version 1 of the Application, and Verify a Successful Deployment

    1. Create the kubeserve-deployment.yaml file, and add the following YAML to create your deployment:

      apiVersion: apps/v1
      kind: Deployment
      metadata:
        name: kubeserve
      spec:
        replicas: 3
        selector:
          matchLabels:
            app: kubeserve
        template:
          metadata:
            name: kubeserve
            labels:
              app: kubeserve
          spec:
            containers:
            - image: linuxacademycontent/kubeserve:v1
              name: app
      
    2. Use the following command to create the deployment:

      kubectl apply -f kubeserve-deployment.yaml --record
      
    3. Use the following command to verify the deployment was successful:

      kubectl rollout status deployments kubeserve
      
    4. Use the following command to verify the app is at the correct version:

      kubectl describe deployment kubeserve
      
  2. Challenge

    Scale Up the Application to Create High Availability

    1. Use the following command to scale up your application to 5 replicas:

      kubectl scale deployment kubeserve --replicas=5
      
    2. Use the following command to verify the additional replicas have been created:

      kubectl get pods
      
  3. Challenge

    Create a Service So Users Can Access the Application

    1. Use the following command to create a service for your deployment:

      kubectl expose deployment kubeserve --port 80 --target-port 80 --type NodePort
      
    2. Use the following command to verify the service is present and collect the cluster IP:

      kubectl get services
      
  4. Challenge

    Perform a Rolling Update to Version 2 of the Application, and Verify Its Success

    1. Use this curl loop command to see the version change as you perform the rolling update:

      while true; do curl http://<ip-address-of-the-service>; done
      
    2. Use this command to perform the update (while the curl loop is running):

      kubectl set image deployments/kubeserve app=linuxacademycontent/kubeserve:v2 --v 6
      
    3. Use this command to view the additional ReplicaSet created during the update:

      kubectl get replicasets
      
    4. Use this command to verify all pods are up and running:

      kubectl get pods
      
    5. Use this command to view the rollout history:

      kubectl rollout history deployment kubeserve
      

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans