Logo

Armand.nz

Home / About / Linkedin / Github

Upgrade all Kubernetes components on the Control Plane and Worker Nodes

#cka #ckd #kubernetes |

References

For example, Upgrade 1.21.00 to 1.21.1

Upgrade All Kubernetes Components on the Control Node

  1. Download kubeadm version

     sudo apt-get update && \
     sudo apt-get install -y --allow-change-held-packages kubeadm=1.21.1-00
    
  2. Drain the control plane node:

     kubectl drain acgk8s-control --ignore-daemonsets
    
  3. Check whether the components are upgradeable to v1.21.1:

     sudo kubeadm upgrade plan v1.21.1
    
  4. Apply the upgrade:

     sudo kubeadm upgrade apply v1.21.1
    
  5. Upgrade kubelet and kubectl:

     sudo apt-get update && \
     sudo apt-get install -y --allow-change-held-packages kubelet=1.21.1-00 kubectl=1.21.1-00
    
  6. Reload daemons

     sudo systemctl daemon-reload
    
  7. Restart kubelet:

     sudo systemctl restart kubelet
    
  8. Uncordon the control plane node:

     kubectl uncordon acgk8s-control
    

Upgrade All Kubernetes Components on the Worker Node

  1. Drain the worker1 node:

     kubectl drain acgk8s-worker1 --ignore-daemonsets --force
    
  2. SSH into the Worker node:

     ssh acgk8s-worker1
    
  3. Install a new version of kubeadm:

     sudo apt-get update && \
     sudo apt-get install -y --allow-change-held-packages kubeadm=1.21.1-00
    
  4. Upgrade the node:

     sudo kubeadm upgrade node
    
  5. Upgrade kubelet and kubectl:

     sudo apt-get update && \
     sudo apt-get install -y --allow-change-held-packages kubelet=1.21.1-00 kubectl=1.21.1-00
    
  6. Reload daemon

    sudo systemctl daemon-reload
    
  7. Restart kubelet:

     sudo systemctl restart kubelet
    
  8. Type exit to exit the node.

  9. Uncordon the node:

    kubectl uncordon acgk8s-worker1
    
  10. Repeat the process above for other worker nodes

comments powered byDisqus

Copyright © Armand