Upgrading the Kubernetes Cluster Using kubeadm

Hands-On Lab

 

Photo of Chad Crowell

Chad Crowell

DevOps Training Architect II in Content

Length

00:30:00

Difficulty

Intermediate

We have been given a three-node cluster that is in need of an upgrade. In this hands-on lab, we must perform the upgrade to all of the cluster components, including kubeadm, kube-controller-manager, kube-scheduler, kubeadm, and kubectl.

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.

Upgrading the Kubernetes Cluster Using kubeadm

Introduction

We have been given a three-node cluster that is in need of an upgrade. In this hands-on lab, we will perform the upgrade to all of the cluster components: kubeadm, kube-controller-manager, kube-scheduler, kubeadm, and kubectl.

Connect to the Lab

Connect to the Master Node

  1. Open your terminal application, and run the following command (remember to replace MASTER_PUBLIC_IP with the public IP you were provided on the lab instructions page):
    ssh cloud_user@MASTER_PUBLIC_IP
  2. Enter y at the prompt.
  3. Enter your cloud_user password at the prompt.

Connect to the Worker Nodes

  1. Run the following command (remember to replace WORKER1_PUBLIC_IP with the public IP you were provided on the lab instructions page):
    ssh cloud_user@WORKER1_PUBLIC_IP
  2. Enter y at the prompt.
  3. Enter your cloud_user password at the prompt.
  4. Run the following command (remember to replace WORKER0_PUBLIC_IP with the public IP you were provided on the lab instructions page):
    ssh cloud_user@WORKER0_PUBLIC_IP
  5. Enter y at the prompt.
  6. Enter your cloud_user password at the prompt.

Install Version 1.13.5 of kubeadm

  1. On the master node, check the current version of kubeadm.
    kubectl get nodes
  2. Create two new variables:
    export VERSION=v1.13.5
    export ARCH=amd64
  3. Get the latest version of kubeadm.
    curl -sSL https://dl.k8s.io/release/${VERSION}/bin/linux/${ARCH}/kubeadm > kubeadm
  4. Install kubeadm.
    sudo install -o root -g root -m 0755 ./kubeadm /usr/bin/kubeadm
  5. Enter your cloud_user password at the prompt.
  6. Verify that the installation was successful.
    sudo kubeadm version
  7. Plan the upgrade to check for errors.
    sudo kubeadm upgrade plan
  8. Apply the upgrade of the kube-scheduler and kube-controller-manager.
    sudo kubeadm upgrade apply v1.13.3
  9. Enter y at the prompt.

Install the Latest Version of kubelet on the Master Node

  1. Get the latest version of kubelet.
    curl -sSL https://dl.k8s.io/release/${VERSION}/bin/linux/${ARCH}/kubelet > kubelet
  2. Install the latest version of kubelet.
    sudo install -o root -g root -m 0755 ./kubelet /usr/bin/kubelet
  3. Restart the kubelet service.
    sudo systemctl restart kubelet.service
  4. Verify that the installation was successful.
    kubectl get nodes

Install the Latest Version of kubelet on the Worker Nodes

  1. Log in to the first worker node.
    ssh ip-10-0-1-102
  2. Enter yes at the prompt.
  3. Enter your cloud_user password at the prompt.
  4. Set the following variables:
    export VERSION=v1.13.5
    export ARCH=amd64
  5. Get the latest version of kubelet.
    curl -sSL https://dl.k8s.io/release/${VERSION}/bin/linux/${ARCH}/kubelet > kubelet
  6. Install the latest version of kubelet.
    sudo install -o root -g root -m 0755 ./kubelet /usr/bin/kubelet
  7. Enter your cloud_user password at the prompt.
  8. Restart the kubelet service.
    sudo systemctl restart kubelet.service
  9. Exit the first worker node.
    exit
  10. Verify that the installation was successful.
    kubectl get nodes
  11. Log in to the second worker node.
    ssh ip-10-0-1-103
  12. Repeat steps 2-8.
  13. Exit the second worker node.
    exit
  14. Verify that the installation was successful.
    kubectl get nodes

Install the Latest Version of kubectl

  1. Get the latest version of kubectl.
    curl -sSL https://dl.k8s.io/release/${VERSION}/bin/linux/${ARCH}/kubectl > kubectl
  2. Install the latest version of kubectl.
    sudo install -o root -g root -m 0755 ./kubectl /usr/bin/kubectl
  3. Verify that the installation was successful.
    kubectl version

Conclusion

Congratulations, you've successfully completed this hands-on lab!