Repository navigation
CKS: make node containerd setup work with containerd 2.x - #14898
bhouse-nexthop wants to merge 1 commit into
Conversation
CKS node bootstrap overwrote /etc/containerd/config.toml with the default config on every node and added the private registry by appending to the config version 2 registry tables. containerd 2.x writes config version 3 or later, where those tables moved, so the registry was silently dropped. The pause image was also only set through the version 2 sandbox_image key. - Generate the default config only when there is none, CRI is disabled (Docker's containerd.io package), or it does not set SystemdCgroup = true; a template's own config is kept otherwise. - Add the registry through config_path and certs.d/<host>/hosts.toml, and its credentials in the auth table for the config version in use. Run this after the base containerd config instead of in its place. - Set the pause image through either sandbox_image (version 2) or pinned_images sandbox (version 3+), in the node templates and in upgrade-kubernetes.sh. Signed-off-by: Brad House <bhouse@nexthop.ai>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14898 +/- ##
=========================================
Coverage 18.34% 18.34%
- Complexity 16671 16678 +7
=========================================
Files 5939 5939
Lines 537817 537814 -3
Branches 65938 65938
=========================================
+ Hits 98640 98673 +33
+ Misses 427954 427917 -37
- Partials 11223 11224 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Tested on a KVM lab, with this change on 4.22 and on main. Each cluster used a private registry with a username and password.
On 4.22 the control node still can't pull from the registry, because the control-node template never writes the registry setup there. That's the bug #14408 fixes on main; with both PRs on main, both nodes pull. Workers are fine on 4.22. containerd 2.4 logs that the registry Not run: the |
Description
Fixes #14896
CKS node bootstrap only worked with containerd 1.x config files. On containerd 2.x the private registry and the pause image were silently not set, because both were written with
sedagainst config version 2 keys. Every node also threw away whatever containerd config the template shipped.containerd config default, template config lostcontainerd.iopackage shipsdisabled_plugins = ["cri"]), or it doesn't setSystemdCgroup = trueregistry.mirrorstable, config version 2 onlyconfig_path+/etc/containerd/certs.d/<host>/hosts.toml, works on 1.7 and 2.xregistry.configs.<host>.authwith username/password, version 2 table onlyauthtable, written for the config version in use, with the base64authfield (a password with a"no longer breaks the script)sandbox_image(version 2)sandbox_imageorpinned_images.sandbox(version 3+), also inupgrade-kubernetes.shA path in the registry URL is still used as the registry's API root, as the old mirror endpoint did (
override_path = truein hosts.toml).Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
http://reg:5000, a password containing"and a space), pulled out the containerdruncmdlines,setup-containerdand the pause imagesed, and ran them in Ubuntu 24.04 containers against the containerd release binaries 1.7.36, 2.0.14 and 2.4.2. Starting configs: none, Docker'scontainerd.ioconfig,version = 2only, a prepared config with a custom setting, a config withSystemdCgroup=falsewritten without spaces, a customconfig_path(kept, with a warning), and running everything twice. Each timecontainerd config dumpparses and showsSystemdCgroup = true, the pause image, the registryconfig_pathand theauthentry. The prepared config keeps its custom setting, and the other configs are regenerated.registry:2with htpasswd auth over plain http, containerd started in a privileged container on the same network, thencrictl pull reg:5000/test/busybox:1.36:http: server gave HTTP response to HTTPS clientcontainerd.iono basic auth credentials(so the pull above really used the auth)http://reg:5000/v2How did you try to break this feature and the system with this change?
config_path: left as is and the script prints a warning. containerd 2.1+ readsconfig_pathas a single directory on some pull paths, so joining two paths isn't safe.SystemdCgroup=falseor a commentedSystemdCgroup = true: regenerated, so containerd and kubelet both use the systemd cgroup driver.Not done here:
registry.configs. Credentials will then need another route, such as image pull secrets or a kubelet credential provider.registry.mirrorsorconfigs.tlscan't be combined withconfig_path; containerd refuses that mix.{% if registry is defined %}, which never matches. fix cks cluster stuck starting when a private registry is set #14408 fixes that.upgrade-kubernetes.shget the pause image fix but not the registry, as before.