From 81b2a1896ad68e53d70211b19508a0e5e1583aff Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 28 Aug 2025 10:04:13 -0700 Subject: [PATCH] Fix kubernetes install methods There are two problems with kubernetes installation currently. The first is that cri-o's package location has moved. The second is the debian bookworms snap install has gone stale and we should update it with snap before installing more snaps. Per the cri-o packaging README [0] the packages for cri-o moved from the k8s package cdn to downloads.opensuse.org. Update our cri-o installation tasks to use the correct package repo. Not updating produces HTTP 403 errors. I guess they want people to notice that they shouldn't use the old location any longer. In the case of debian bookworm the microk8s snap needs a core snap version available in a newer snapd release. We can use snap to install snap in order to update snap. Do that so that microk8s can be installed on Debian. [0] https://github.com/cri-o/packaging/blob/3b30cfee75169c3a23ad517641f463f5c373009d/README.md Change-Id: Ied971eb4ae4f53440fdb7204540b4360ab797e74 --- roles/ensure-kubernetes/tasks/crio-default.yaml | 4 ++-- roles/ensure-kubernetes/tasks/microk8s.yaml | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/roles/ensure-kubernetes/tasks/crio-default.yaml b/roles/ensure-kubernetes/tasks/crio-default.yaml index 46760257b..d14c867e0 100644 --- a/roles/ensure-kubernetes/tasks/crio-default.yaml +++ b/roles/ensure-kubernetes/tasks/crio-default.yaml @@ -6,10 +6,10 @@ vars: repositories_keys: - url: "https://pkgs.k8s.io/core:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/Release.key" - - url: "https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/Release.key" + - url: "https://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/Release.key" repositories_list: - repo: "deb https://pkgs.k8s.io/core:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/ /" - - repo: "deb https://pkgs.k8s.io/addons:/cri-o:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/ /" + - repo: "deb https://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/ /" - name: Install packages package: diff --git a/roles/ensure-kubernetes/tasks/microk8s.yaml b/roles/ensure-kubernetes/tasks/microk8s.yaml index ef73a9a6b..5c16aca75 100644 --- a/roles/ensure-kubernetes/tasks/microk8s.yaml +++ b/roles/ensure-kubernetes/tasks/microk8s.yaml @@ -9,6 +9,15 @@ name: snapd state: present +# Snapd isn't installed as a snap on Debian (it is on Ubuntu). After the +# base install we use snap to update itself so that we're running a modern +# snapd +# Otherwise some snaps complain about missing their dependencies. +- name: Update snap on Debian + become: yes + command: snap install core snapd + when: ansible_distribution == "Debian" + - name: Install microk8s snap become: yes command: 'snap install microk8s --classic --channel={{ ensure_kubernetes_microk8s_channel }}'