see doc Exercise 4.1 Basic Node Maintenance.pdf ---------------------------------------------------------------control plane-------------------------------------------------------------- ---------------------------------------------------------------control plane-------------------------------------------------------------- ---------------------------------------------------------------control plane-------------------------------------------------------------- ---------------------------------------------------------------control plane-------------------------------------------------------------- ---------------------------------------------------------------control plane-------------------------------------------------------------- 1. Begin by updating the package metadata for APT student@cp:~$ sudo apt update 2. View the available packages. The list will be long, you may have to scroll back up to the top to find a recent version. Wewill choose the1.22.1version student@cp:~$ sudo apt-cache madison kubeadm 3. Remove the hold on kubeadm and update the package. student@cp:~$ sudo apt-mark unhold kubeadm student@cp:~$ sudo apt-get install -y kubeadm=1.22.1-00 4. Hold the package again to prevent updates along with other software. student@cp:~$ sudo apt-mark hold kubeadm 5. Verify the version of Kubeadm installed. student@cp:~$ sudo kubeadm version 6. To prepare the cp node for update we first need to evict as many pods as possible. The nature of daemonsets is to havethem on every node, and some such asCalicomust remain. Change the name to your node name, and ignore thedaemonsets student@cp:~$ kubectl drain k8scp --ignore-daemonsets 7. Use the upgrade plan argument to check the existing cluster and then update the software. You may notice that thereare versions available later than v1.22.1. Use the v1.22.1 version. Read through the output and get a feel for what wouldbe changed in an upgrade student@cp:~$ sudo kubeadm upgrade plan 8. We are now ready to actually upgrade the software. There will be a lot of output. Be aware the command will ask ifyou want to proceed with the upgrade, answeryes. Take a moment and look for any errors or suggestions, such asupgrading the version of etcd, or some other package student@cp:~$ sudo kubeadm upgrade apply v1.22.1 9. Check projectcalico.org or other CNI for supported version to match any updates. While the apply command may showsome information projects which are not directly connected to Kubernetes may need to be updated to work with the newversion 10. Check the status of the nodes. The cp should show scheduling disabled. Also as we have not updated all the softwareand restarted the daemons it will show the previous version student@cp:~$ kubectl get node 11. Release the hold on kubelet and kubectl student@cp:~$ sudo apt-mark unhold kubelet kubectl 12. Upgrade both packages to the same version as kubeadm. student@cp:~$ sudo apt-get install -y kubelet=1.22.1-00 kubectl=1.22.1-00 13. Again add the hold so other updates don’t update the Kubernetes software student@cp:~$ sudo apt-mark hold kubelet kubectl 14. Restart the daemons. student@cp:~$ sudo systemctl daemon-reload student@cp:~$ sudo systemctl restart kubelet 15. Verify the cp node has been updated to the new version. student@cp:~$ kubectl get node INI----------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- Then update other cp nodes using the same process exceptsudo kubeadm upgrade nodeinstead ofsudo kubeadm upgrade apply -------------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- -------------------------------------------------------other control plane-------------------------------------------------------------- FIN----------------------------------------------------other control plane-------------------------------------------------------------- 16. Now make the cp available for the scheduler, again change the name to match the cluster node name on your controlplane. student@cp:~$ kubectl uncordon k8scp 17. Verify the cp now shows aReadystatus student@cp:~$ kubectl get node -------------------------------------------------------workers node----------------------------------------------------------------------- -------------------------------------------------------workers node----------------------------------------------------------------------- -------------------------------------------------------workers node----------------------------------------------------------------------- -------------------------------------------------------workers node----------------------------------------------------------------------- -------------------------------------------------------workers node----------------------------------------------------------------------- 18. Now update the worker node(s) of the cluster.Open a second terminal session to the worker. Note that you will needto run a couple commands on the cp as well, having two sessions open may be helpful. Begin by allowing the softwareto update on the worker. student@worker:~$ sudo apt-mark unhold kubeadm 19. Update the kubeadm package to the same version as the cp node student@worker:~$ sudo apt-get update && sudo apt-get install -y kubeadm=1.22.1-00 20. Hold the package again student@worker:~$ sudo apt-mark hold kubeadm 21. Back on the cp terminal sessiondrain the worker node, but allow the daemonsets to remain. student@cp:~$ kubectl drain worker --ignore-daemonsets 22. Return to theworkernode and download the updated node configuration. student@worker:~$ sudo kubeadm upgrade node 23. Remove the hold on the software then update to the same version as set on the cp. student@worker:~$ sudo apt-mark unhold kubelet kubectl student@worker:~$ sudo apt-get install -y kubelet=1.22.1-00 kubectl=1.22.1-00 24. Ensure the packages don’t get updated when along with regular updates. student@worker:~$ sudo apt-mark hold kubelet kubectl 25. Restart daemon processes for the software to take effect. student@worker:~$ sudo systemctl daemon-reload student@worker:~$ sudo systemctl restart kubelet 26. Return to the cp node. View the status of the nodes. Notice the worker status. student@cp:~$ kubectl get node 27. Allow pods to be deployed to the worker node. student@cp:~$ kubectl uncordon worker 28. Verify the nodes both show aReadystatus and the same upgraded version. student@cp:~$ kubectl get nodes