Upgrading kubeadm to version not displayed by `madison` command

In the CKA lab, I’m trying out the kodekloud exercise for cluster upgrade (from v1.28 to v1.29.0). However v1.29 doesn’t seem to be displayed by the madison command. Am I supposed to upgrade to the latest 1.28 version before attempting it to upgrade to 1.29? Quite confused how to proceed here.

 controlplane ~ ✖ apt-cache madison kubeadm

   kubeadm | 1.28.7-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.6-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.5-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.4-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.3-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.2-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.1-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages
   kubeadm | 1.28.0-1.1 | https://pkgs.k8s.io/core:/stable:/v1.28/deb  Packages

To install binaries like kubeadm, kubelet and kubectl, you need to configure the APT package manager to install exactly that minor version (a minor version is something like 1.28 or 1.29 – version 1 is the major version). So your problem here is that you have APT configured to install 1.28, but not 1.29. You can find the instructions in the docs here, which tells you to edit /etc/apt/sources.list.d/kubernetes.list .

The file needs a “deb” line for each minor version you need to be able to install:

$ cat /etc/apt/sources.list.d/kubernetes.list
deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /

If you already have that file on your system, that line needs to reference the minor version you want, or you need another deb line with the new version. Either approach will work.

3 Likes

Thanks a lot, Rob!

I think you linked the udemy video instead of this link: Changing The Kubernetes Package Repository | Kubernetes - But the pointers were more than enough!

I just had to replace 1.28 with 1.29 in the file /etc/apt/sources.list.d/kubernetes.list and madison showed me all the 1.29 kubeadm versions!

2 Likes

That’s I got for skipping over

If you’re using the community-owned package repositories (pkgs.k8s.io), you need to enable the package repository for the desired Kubernetes minor release. This is explained in Changing the Kubernetes package repository document.

1 Like

Im getting the below error.

sudo kubeadm upgrade apply v1.29.0-1.1
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster…
[upgrade/config] FYI: You can look at this config file with ‘kubectl -n kube-system get cm kubeadm-config -o yaml’
[preflight] Running pre-flight checks.
[upgrade] Running cluster health checks
[upgrade/version] You have chosen to change the cluster version to “v1.29.0-1.1”
[upgrade/versions] Cluster version: v1.28.0
[upgrade/versions] kubeadm version: v1.29.0
[upgrade/version] FATAL: the --version argument is invalid due to these errors:

    - Specified version to upgrade to "v1.29.0-1.1" is an unstable version and such upgrades weren't allowed via setting the --allow-*-upgrades flags

Can be bypassed if you pass the --force flag
To see the stack trace of this error execute with --v=5 or higher

1.29.0-1.1 is the package version, but for purposes of installing with kubeadm init, you want to use 1.29.0:

kubeadm upgrade apply v1.29.0