# Replace with the desired versionexportK8S_VERSION="1.31.0"# Upgrade kubeadmsudoapt-markunholdkubeadm&&\sudoapt-getupdate&&sudoapt-getinstall-ykubeadm="$K8S_VERSION-*"&&\sudoapt-markholdkubeadm
# Verify that the cluster is upgradeablesudokubeadmupgradeplan
Commencer la montée en niveau avec la commande apply
# Drain the node. You may need to replace $HOSTNAME with the correct node name.kubectldrain$HOSTNAME--ignore-daemonsets
# Upgrade the kubelet and kubectlsudoapt-markunholdkubeletkubectl&&\sudoapt-getupdate&&\sudoapt-getinstall-ykubelet="$K8S_VERSION-*"kubectl="$K8S_VERSION-*"&&\sudoapt-markholdkubeletkubectl
# Restart the kubeletsudosystemctldaemon-reload
sudosystemctlrestartkubelet
# Uncordon the nodekubectluncordon$HOSTNAME
# Replace with the desired versionexportK8S_VERSION="1.31.0"# Upgrade kubeadmsudoapt-markunholdkubeadm&&\sudoapt-getupdate&&sudoapt-getinstall-ykubeadm="$K8S_VERSION-*"&&\sudoapt-markholdkubeadm
# Upgrade the local kubelet configurationsudokubeadmupgradenode
# Replace <node-to-drain> with the name of your node you are drainingkubectldrain<node-to-drain>--ignore-daemonsets
# You may need to add --delete-emptydir-data in order to drain the nodekubectldrain<node-to-drain>--ignore-daemonsets--delete-emptydir-data
# Upgrade the kubelet and kubectlsudoapt-markunholdkubeletkubectl&&\sudoapt-getupdate&&\sudoapt-getinstall-ykubelet="$K8S_VERSION-*"kubectl="$K8S_VERSION-*"&&\sudoapt-markholdkubeletkubectl
# Restart the kubeletsudosystemctldaemon-reload
sudosystemctlrestartkubelet