fix: containerd config compatible with both 1.x and 2.x CRI plugins#5999
fix: containerd config compatible with both 1.x and 2.x CRI plugins#5999kriscoleman wants to merge 1 commit into
Conversation
The previous containerd_configure() approach deleted the [...runtimes.runc.options] TOML section header and appended a replacement using the containerd 1.x plugin name (io.containerd.grpc.v1.cri). This caused two problems: 1. Deleting the section header orphaned key-value pairs (like SystemdCgroup) under the wrong TOML section, corrupting the config. 2. The appended section used the 1.x plugin name which containerd 2.x (shipped by AL2023, Ubuntu 24.04) does not recognize, so the CRI runtime plugin never received the SystemdCgroup=true setting. Replace the delete-and-append approach with an in-place sed substitution (SystemdCgroup = false → true) that works regardless of which CRI plugin name wraps the runc.options section. Also create /etc/containerd/certs.d before restarting containerd so the config_path directory exists. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.7.28-k8s-ctrd-2026-05-05T16:31:31Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.7.29-k8s-ctrd-2026-05-05T16:31:47Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.7.26-k8s-ctrd-2026-05-05T16:32:06Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.7.27-k8s-ctrd-2026-05-05T16:33:17Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.7.25-k8s-ctrd-2026-05-05T16:33:24Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.6.33-k8s-ctrd-2026-05-05T16:38:23Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.6.32-k8s-ctrd-2026-05-05T16:38:29Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.6.28-k8s-ctrd-2026-05-05T16:40:04Z |
|
Testgrid Run(s) Executing @ https://testgrid.kurl.sh/run/pr-5999-c629ec2-containerd-1.6.31-k8s-ctrd-2026-05-05T16:40:09Z |
Summary
Fixes CRI v1
RuntimeServiceregistration failure during kubeadm preflight on release v2026.05.05-0:Root cause
containerd_configure()used a delete-and-append approach for theSystemdCgrouprunc option:sed -i '/containerd.runtimes.runc.options/d'— deleted the[...runc.options]TOML section headerio.containerd.grpc.v1.cri)This caused two problems:
SystemdCgroup = false,BinaryName, etc.) under the wrong TOML section[...runtimes.runc]instead of[...runtimes.runc.options]io.containerd.grpc.v1.criplugin nameio.containerd.cri.v1.runtime— the 1.x name is ignoredAdditionally,
config_pathwas set to/etc/containerd/certs.d(added in #5945) but the directory was never created before containerd restarted.Fix
sed 's/SystemdCgroup = false/SystemdCgroup = true/'modifies the value where it already exists, preserving the TOML structure for both containerd 1.x and 2.x/etc/containerd/certs.dbefore containerd restarts so theconfig_pathdirectory existsFiles changed
addons/containerd/template/base/install.sh— template (source of truth)addons/containerd/1.7.{25-29}/install.sh— active 1.7.x versionsaddons/containerd/1.6.{28,31,32,33}/install.sh— active 1.6.x versionsCMX Validation
Tested on two Ubuntu 24.04 CMX VMs (containerd 2.2.1 from OS repos) with kubeadm v1.34.3.
Side-by-side comparison
grpc.v1.cri, appended at line 273)cri.v1.runtime, preserved at line 100)falseorphaned @108,true@274)true@109, in-place)/etc/containerd/certs.dBROKEN config warnings (containerd 2.2.1 log)
FIXED config log
Note on reproduction
The exact CRI
Unimplementederror could not be reproduced on Ubuntu 24.04 — containerd 2.2.1 tolerates the config corruption (it logs warnings but still initializes the CRI plugin). The original failure in v2026.05.05-0 likely occurs on Amazon Linux 2023 or another OS with a containerd 2.x build that is stricter about config validation. CMX currently only supports Ubuntu VMs, so AL2023 testing requires the full testgrid.Test plan
SystemdCgroup = trueis set correctly in/etc/containerd/config.tomlpost-install/etc/containerd/certs.ddirectory exists post-install