Kubespray handles upgrades the same way it handles initial deployment. That is to say that each component is laid down in a fixed order.
Usages
First, check current all node version(v.1.21.4):
1 2 3 4 5 6 7 8 9
# kubectl get nodes NAME STATUS ROLES AGE VERSION node1 Ready control-plane,master 8d v1.21.4 node2 Ready control-plane,master 8d v1.21.4 node3 Ready control-plane,master 5d v1.21.4 # kubectl version Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.4", GitCommit:"3cce4a82b44f032d0cd1a1790e6d2f5a55d20aae", GitTreeState:"clean", BuildDate:"2021-08-11T18:16:05Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.4", GitCommit:"3cce4a82b44f032d0cd1a1790e6d2f5a55d20aae", GitTreeState:"clean", BuildDate:"2021-08-11T18:10:22Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}
Graceful upgrade
Kubespray supports cordon, drain and uncordoning of nodes when performing a cluster upgrade. There is a separate playbook used for this purpose. It is important to note that upgrade-cluster.yml can only be used for upgrading an existing cluster. That means there must be at least 1 kube_control_plane already deployed.