Patching Live Kubernetes Deployments and Draining a Node for Maintenance

2 hours
  • 4 Learning Objectives

About this Hands-on Lab

This lab guides the student through the creation of a cluster using kops. Once created, the cluster is used to deploy four replicas of the NGINX web server. Then the kubectl patch command is used to update the version of NGINX running in the pod containers. The last exercise is to drain a node for maintenance.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the Cluster
  1. Create the cluster configuration using the script provided.
  2. Update the cluster using kops.
  3. Validate the cluster.
Deploy the NGINX Replicas
  1. Deploy four replicas of the NGINX web server, version 1.7.9 from the GitHub repo.
  2. View the Pods running.
  3. View the version of the container within the Pod.
Patch the Live Containers
  1. Download the NGINX 1.9.1 Pod spec with the wget command from the GitHub repo.
  2. Patch the live containers running in the nginx-deployment with version 1.9.1.
  3. Interrogate the status of the deployment.
  4. Check the Pods.
Drain a Worker Node for Maintenance
  1. See which pods are running on which nodes.
  2. Select a node to drain and drain it.
  3. Examine the status of the deployment replicas.
  4. Reattach the node.

Additional Resources

This lab guides the student through the creation of a cluster using kops and then the deployment of four replicas of the NGINX web server. The kubectl patch command is then used to patch a live deployment and the version of NGINX is upgraded.

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.

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?