alias k=kubectl
kubectl get nodes
kubectl describe node | grep Taints
# how many applications are hosted on the cluster
kubectl get deploy
# what is the latest stable version available for upgrade
kubeadm upgrade plan
# drain the master node of workloads
k drain controlplane --ignore-daemonsets
# upgrade the controlplane components to exact version v1.20.0
# version check
cat /etc/*release*
NAME=Ubuntu
apt update
apt-cache madison kubeadm
apt-get --version
apt-get install -y --allow-change-held-packages kubeadm=1.20.0-00
kubeadm version
kubeadm upgrade plan
sudo kubeadm upgrade apply v1.20.0
apt-get update && \\
apt-get install -y --allow-change-held-packages kubelet=1.20.x-00 kubectl=1.20.x-00
sudo systemctl daemon-reload
sudo systemctl restart kubelet
k get nodes
k uncordon controlplane
k drain node01
k get node
k get pods -o wide
# upgrade the worker node to the exact version v1.20.0
k get nodes -o wide
ssh 10.38.209.12
apt update
apt-cache madison kubeadm
apt-get --version
apt-get install -y --allow-change-held-packages kubeadm=1.20.x-00
sudo kubeadm upgrade node
apt-get update && \\
apt-get install -y --allow-change-held-packages kubelet=1.20.0-00 kubectl-1.20.0-00
sudo systemctl daemon-reload
sudo systemctl restart kubelet
exit
k get nodes
k uncordon node01
On the controlplane node, run the command run the following commands:
apt update
This will update the package lists from the software repository.
apt install kubeadm=1.20.0-00
This will install the kubeadm version 1.20
kubeadm upgrade apply v1.20.0
This will upgrade kubernetes controlplane. Note that this can take a few minutes.
apt install kubelet=1.20.0-00
#This will update the kubelet with the version 1.20.
You may need to restart kubelet after it has been upgraded.
Run: systemctl restart kubelet