Files
zuul-jobs/roles/ensure-kubernetes/tasks/crio-default.yaml
Clark Boylan 81b2a1896a 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] 3b30cfee75/README.md

Change-Id: Ied971eb4ae4f53440fdb7204540b4360ab797e74
2025-08-28 11:41:02 -07:00

63 lines
1.8 KiB
YAML

- name: Add all repositories
# Instructions from here: https://github.com/cri-o/packaging making
# the assumption that CRIO_VERSION == KUBERNETES_VERSION
include_role:
name: ensure-package-repositories
vars:
repositories_keys:
- url: "https://pkgs.k8s.io/core:/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://download.opensuse.org/repositories/isv:/cri-o:/stable:/{{ ensure_kubernetes_kubectl_version }}/deb/ /"
- name: Install packages
package:
name:
- cri-o
- runc
- containernetworking-plugins
- cri-tools
- podman
- kubernetes-cni
state: present
become: true
# The the following two options are recommended from cri-o install notes
- name: Enable ipv4 forwarding
sysctl:
name: net.ipv4.ip_forward
value: '1'
sysctl_set: true
state: present
reload: true
become: true
- name: Load br_netfilter
modprobe:
name: br_netfilter
state: present
persistent: present
become: true
- name: Find networking plugins
ini_file:
path: /etc/crio/crio.conf
section: crio.network
option: plugin_dirs
value:
- '/opt/cni/bin/'
- '/usr/lib/cni'
mode: 0644
become: true
register: _crio_conf_updated
# NOTE: want to restart here rather than notify and do it later, so
# that we don't go on without the config correct.
- name: Restart crio to pickup changes # noqa no-handler
service:
name: crio
state: restarted
become: yes
when: _crio_conf_updated.changed