From db89709bf365a2b412f4d348b1299f196d4ceac0 Mon Sep 17 00:00:00 2001 From: fireflycons <34012094+fireflycons@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:16:41 +0000 Subject: [PATCH] Update for 1.28 -> 1.29 --- docs/14-Lightning-Labs/02-Lightning-Lab-1.md | 78 +++++++++++++------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/docs/14-Lightning-Labs/02-Lightning-Lab-1.md b/docs/14-Lightning-Labs/02-Lightning-Lab-1.md index eef978f8..e5db82bd 100644 --- a/docs/14-Lightning-Labs/02-Lightning-Lab-1.md +++ b/docs/14-Lightning-Labs/02-Lightning-Lab-1.md @@ -5,58 +5,76 @@ ## Solution to LL-1 1.
- Upgrade the current version of kubernetes from 1.26.0 to 1.27.0 exactly using the kubeadm utility. + Upgrade the current version of kubernetes from 1.28.0 to 1.29.0 exactly using the kubeadm utility. - There is currently an issue with this lab which requires an extra step. This may be addressed in the near future. + Make sure that the upgrade is carried out one node at a time starting with the controlplane node. To minimize downtime, the deployment `gold-nginx` should be rescheduled on an alternate node before upgrading each node. + + + Upgrade `controlplane` node first and drain node `node01` before upgrading it. Pods for `gold-nginx` should run on the controlplane node subsequently. On controlplane node - 1. Drain node + 1. Update package repo - ``` - kubectl drain controlplane --ignore-daemonsets + ```bash + apt update ``` - 1. Upgrade kubeadm + 1. Check madison to see what kubernetes packages are available - ``` - apt-get update - apt-mark unhold kubeadm - apt-get install -y kubeadm=1.27.0-00 + ```bash + apt-cache madison kubeadm ``` - 1. Plan and apply upgrade + Note that only 1.28 versions are present, meaning you have to grab the 1.29 repos + + 1. Grab kubernetes 1.29 repos + ```bash + mkdir -p /etc/apt/keyrings + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-1.29-apt-keyring.gpg + echo "deb [signed-by=/etc/apt/keyrings/kubernetes-1.29-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list ``` - kubeadm upgrade plan - kubeadm upgrade apply v1.27.0 + + Note that the filename `kubernetes-1.29-apt-keyring.gpg` is arbitrary. There is already an existing file `kubernetes-apt-keyring.gpg` which we don't want to overwrite. As long as the filenames in the `curl` and `echo` commands match, you're good. + + 1. Now run madison again to find out the package version for 1.29 + + ```bash + apt-cache madison kubeadm ``` - 1. Remove taint on controlplane node. This is the issue described above. As part of the upgrade specifically to 1.26, some taints are added to all controlplane nodes. This will prevent the `gold-nginx` pod from being rescheduled to the controlplane node later on. + You should see the following in the list + + > `kubeadm | 1.29.0-1.1 | https://pkgs.k8s.io/core:/stable:/v1.29/deb Packages` + + Now we know the package version is `1.29.0-1.1` we can proceed with the upgrade + + 1. Drain node ``` - kubectl describe node controlplane | grep -A 3 taint + kubectl drain controlplane --ignore-daemonsets ``` - Output: + 1. Upgrade kubeadm ``` - Taints: node-role.kubernetes.io/control-plane:NoSchedule - node.kubernetes.io/unschedulable:NoSchedule + apt-mark unhold kubeadm + apt install -y kubeadm=1.29.0-1.1 ``` - Let's remove them + 1. Plan and apply upgrade ``` - kubectl taint node controlplane node-role.kubernetes.io/control-plane:NoSchedule- - kubectl taint node controlplane node.kubernetes.io/unschedulable:NoSchedule- + kubeadm upgrade plan + kubeadm upgrade apply v1.29.0 ``` 1. Upgrade the kubelet ``` apt-mark unhold kubelet - apt-get install -y kubelet=1.27.0-00 + apt install -y kubelet=1.29.0-1.1 systemctl daemon-reload systemctl restart kubelet ``` @@ -71,7 +89,7 @@ ``` apt-mark unhold kubectl - apt-get install -y kubectl=1.27.0-00 + apt install -y kubectl=1.29.0-1.1 ``` 1. Re-hold packages @@ -92,12 +110,20 @@ ssh node01 ``` + 1. As before, you will need to update the package caches for v1.29 + + ```bash + mkdir -p /etc/apt/keyrings + curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-1.29-apt-keyring.gpg + echo "deb [signed-by=/etc/apt/keyrings/kubernetes-1.29-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list + apt update + ``` + 1. Upgrade kubeadm ``` - apt-get update apt-mark unhold kubeadm - apt-get install -y kubeadm=1.27.0-00 + apt install -y kubeadm=1.29.0-1.1 ``` 1. Upgrade node @@ -110,7 +136,7 @@ ``` apt-mark unhold kubelet - apt-get install kubelet=1.27.0-00 + apt install kubelet=1.29.0-1.1 systemctl daemon-reload systemctl restart kubelet ```