Upgrading your Kubernetes Cluster before v1.24
Background
Kubernetes versions <v1.24 has been deprecated and removed from the official kubernetes pckage repositories.
Hence if you’re < v1.24, you will no longer have the support being able to do your upgrades with the help of the official package repositories.
You will need to upgrade your clusters manually until at least v1.24
before you can continue with the official documentations.
This guide is for upgrading of k8s clusters that was installed by kubeadm
Upgrading
Preparing the upgrade
But fret not, the “manual” upgrade is surprisingly not too difficult.
- Download the server binaries of the version that you want to upgrade to
- You can find this in the various changelogs on the official github repository:
- Select the changelog of the major version that you want to upgrade to, for example: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.21.md
- Click on “Server Binaries”
- Grab the link to the binaries of your system architecture
- Untar the tarball and head to
./kubernetes/server/bin
and copykubeadm
andkubelet
to all the nodes that you’re going to be upgrading
Upgrading the nodes
With the copied kubeadm
and kubelet
in your nodes, we can now start the upgrade process.
Most of the following steps follows the guide at https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-upgrade/ We just subtitute reference to
kubeadm
andkubelet
to the copied binary.
It is important to upgrade each node one at a time.
First Control Plane Node
sudo /path/to/copied/kubeadm upgrade plan
sudo /path/to/copied/kubeadm upgrade apply <version>
- Once the upgrade is completed, you will need to manually update
kubelet
- Stop the kubelet.service with
systemctl stop kubelet
- Copy the binary:
sudo cp /path/to/copied/kubelet /usr/bin
- Restart the kubelet service
systemctl start kubelet
- Stop the kubelet.service with
- Observe your nodes with
kubectl get nodes -w
and watch as the node comes out with the new version.
Other Control Plane Nodes
sudo /path/to/copied/kubeadm upgrade node
- Once the upgrade is completed, you will need to manually update
kubelet
- Stop the kubelet.service with
systemctl stop kubelet
- Copy the binary:
sudo cp /path/to/copied/kubelet /usr/bin
- Restart the kubelet service
systemctl start kubelet
- Stop the kubelet.service with
- Observe your nodes with
kubectl get nodes -w
and watch as the node comes out with the new version.
Worker Nodes
- `sudo /path/to/copied/kubeadm upgrade node
- Once the upgrade is completed, you will need to manually update
kubelet
- Stop the kubelet.service with
systemctl stop kubelet
- Copy the binary:
sudo cp /path/to/copied/kubelet /usr/bin
- Restart the kubelet service
systemctl start kubelet
- Stop the kubelet.service with
- Observe your nodes with
kubectl get nodes -w
and watch as the node comes out with the new version.
tl;dr
Upgrading your k8s cluster without access and support to the official package repository just requires you to:
- Grab the server binaries from the official releases
- Copy the
kubeadm
andkubelet
binaries to the respective nodes that will be undergoing an upgrade - Perform the
kubeadm upgrade
process - Copy the updated
kubelet
to the/usr/bin/
directory - Restart the
kubelet
service.