Skip to content

Commit

Permalink
Update for 1.28 -> 1.29
Browse files Browse the repository at this point in the history
  • Loading branch information
fireflycons committed Mar 5, 2024
1 parent ba1c18c commit db89709
Showing 1 changed file with 52 additions and 26 deletions.
78 changes: 52 additions & 26 deletions docs/14-Lightning-Labs/02-Lightning-Lab-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,76 @@
## Solution to LL-1

1. <details>
<summary>Upgrade the current version of kubernetes from 1.26.0 to 1.27.0 exactly using the kubeadm utility.</summary>
<summary>Upgrade the current version of kubernetes from 1.28.0 to 1.29.0 exactly using the kubeadm utility.</summary>

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
```
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
```
Expand Down

0 comments on commit db89709

Please sign in to comment.