Skip to main content

Patching Live Kubernetes Deployments and Draining a Node for Maintenance

Hands-On Lab


Photo of

Training Architect





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

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

This lab allows the student to instantiate a cluster using kops. Then they may use a deployment spec to deploy four replicas of the NGINX web server. The kubectl patch command is then used to upgrade the pod spec while the deployment is live. This causes a rolling update of the container instances. The student may then interrogate the pod containers to verify that the upgrade was done. Lastly, the kubectl drain command is used to cordon a worker node and evict the running pod instances. An uncordon command is used to rejoin that node.