Upgrade Kubernetes to 1.26
The following will update the 3 node cluster build here to 1.26.
Before installing 1.26 the hosts need to be running containerd > 1.6, the Ubuntu 20.04 hosts can be upgraded using the instructions here
Upgrading the Master node
1$ export RELEASE=1.26.0
2
3$ sudo apt-get update && sudo apt-get install -y --allow-change-held-packages kubeadm=$RELEASE-00
4
5$ kubectl drain k8s-control --ignore-daemonsets
6
7$ sudo kubeadm upgrade plan v$RELEASE
8
9[upgrade/config] Making sure the configuration is correct:
10[upgrade/config] Reading configuration from the cluster...
11[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
12[preflight] Running pre-flight checks.
13[upgrade] Running cluster health checks
14[upgrade] Fetching available versions to upgrade to
15[upgrade/versions] Cluster version: v1.25.3
16[upgrade/versions] kubeadm version: v1.26.0
17[upgrade/versions] Target version: v1.26.0
18[upgrade/versions] Latest version in the v1.25 series: v1.26.0
19
20W1212 10:19:42.929073 4860 configset.go:177] error unmarshaling configuration schema.GroupVersionKind{Group:"kubeproxy.config.k8s.io", Version:"v1alpha1", Kind:"KubeProxyConfiguration"}: strict decoding error: unknown field "udpIdleTimeout"
21Components that must be upgraded manually after you have upgraded the control plane with 'kubeadm upgrade apply':
22COMPONENT CURRENT TARGET
23kubelet 3 x v1.25.4 v1.26.0
24
25Upgrade to the latest version in the v1.25 series:
26
27COMPONENT CURRENT TARGET
28kube-apiserver v1.25.3 v1.26.0
29kube-controller-manager v1.25.3 v1.26.0
30kube-scheduler v1.25.3 v1.26.0
31kube-proxy v1.25.3 v1.26.0
32CoreDNS v1.9.3 v1.9.3
33etcd 3.5.4-0 3.5.6-0
34
35You can now apply the upgrade by executing the following command:
36
37 kubeadm upgrade apply v1.26.0
38
39_____________________________________________________________________
40
41
42The table below shows the current state of component configs as understood by this version of kubeadm.
43Configs that have a "yes" mark in the "MANUAL UPGRADE REQUIRED" column require manual config upgrade or
44resetting to kubeadm defaults before a successful upgrade can be performed. The version to manually
45upgrade to is denoted in the "PREFERRED VERSION" column.
46
47API GROUP CURRENT VERSION PREFERRED VERSION MANUAL UPGRADE REQUIRED
48kubeproxy.config.k8s.io v1alpha1 v1alpha1 no
49kubelet.config.k8s.io v1beta1 v1beta1 no
50
51
52
53$ sudo kubeadm upgrade apply v$RELEASE
54
55[upgrade/config] Making sure the configuration is correct:
56[upgrade/config] Reading configuration from the cluster...
57[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
58W1212 10:20:27.629919 5162 configset.go:177] error unmarshaling configuration schema.GroupVersionKind{Group:"kubeproxy.config.k8s.io", Version:"v1alpha1", Kind:"KubeProxyConfiguration"}: strict decoding error: unknown field "udpIdleTimeout"
59[preflight] Running pre-flight checks.
60[upgrade] Running cluster health checks
61[upgrade/version] You have chosen to change the cluster version to "v1.26.0"
62[upgrade/versions] Cluster version: v1.25.3
63[upgrade/versions] kubeadm version: v1.26.0
64[upgrade] Are you sure you want to proceed? [y/N]: y
65[upgrade/prepull] Pulling images required for setting up a Kubernetes cluster
66[upgrade/prepull] This might take a minute or two, depending on the speed of your internet connection
67[upgrade/prepull] You can also perform this action in beforehand using 'kubeadm config images pull'
68[upgrade/apply] Upgrading your Static Pod-hosted control plane to version "v1.26.0" (timeout: 5m0s)..
69......
70[addons] Applied essential addon: CoreDNS
71[addons] Applied essential addon: kube-proxy
72
73[upgrade/successful] SUCCESS! Your cluster was upgraded to "v1.26.0". Enjoy!
74
75[upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.
76
77$ sudo apt-get update && sudo apt-get install -y --allow-change-held-packages kubelet=$RELEASE-00 kubectl=$RELEASE-00
78
79$ sudo systemctl daemon-reload
80
81$ sudo systemctl restart kubelet
82
83$ kubectl uncordon k8s-control
84
85$ kubectl get nodes
Upgrading the Worker nodes
Note: these need to be followed on both workers nodes
On the master run
1$ kubectl drain worker-1|2 --ignore-daemonsets --force
On the worker node
1
2$ export RELEASE=1.26.0
3$ sudo apt-get update &&
4$ sudo apt-get install -y --allow-change-held-packages kubeadm=$RELEASE-00
5
6$ sudo kubeadm upgrade node
7
8[upgrade] Reading configuration from the cluster...
9[upgrade] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
10[preflight] Running pre-flight checks
11[preflight] Skipping prepull. Not a control plane node.
12[upgrade] Skipping phase. Not a control plane node.
13[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
14[upgrade] The configuration for this node was successfully updated!
15[upgrade] Now you should go ahead and upgrade the kubelet package using your package manager.
16
17$ sudo apt-get update && sudo apt-get install -y --allow-change-held-packages kubelet=$RELEASE-00 kubectl=$RELEASE-00
18
19$ sudo systemctl daemon-reload
20$ sudo systemctl restart kubelet
Back on the master run
1
2$ kubectl uncordon worker-1|2
comments powered by Disqus