Containerd 问题处理

Containerd 问题处理
.升级后 containerd 配置格式适配问题问题原因截止当前最新的 2.3.2 为止仓库提供的文档中提到当前最新版本为version 4时每次启动后会自动将旧配置识别为新配置但旧配置文件本身保持不变。The latest version is version 4. The configuration is automatically migrated to the latest version on each startup, leaving the configuration file unchanged.表现形式根据上文描述并不会发生什么问题。所以可以完全不用更改旧配置内容。解决方式为了便于后续维护还是应该将配置迁移至新版本格式我总结了两种官方提供的方式全量迁移通过生成新版本格式的配置后把老配置中的自定义参数应用到新格式中# 生成 v4 新版本格式 containerd config default # 将旧版本自定义参数更新到新格式中,可通过下面这条命令把自定义参数摘出来改一下 # 此命令有 BUG 未修复: 尽管会输出自定义参数与默认配置会一起输出(详见下面的 ISSUE 链接) # containerd config migrate自定义参数迁移目前有 bug 还未修复还是会输出默认参数只迁移旧配置中自定义的参数。个人感觉既然都迁移了不如直接生成新格式后全量迁移...并不费事读取旧配置文件把 version 升到 4schema 迁移但废弃字段plugin_dir、disable_cgroup 等也读进来了strict 模式解析时发现这些键在 v4 结构体里不存在报 WARN 并忽略。# containerd config migrate WARN[0000] Ignoring unknown key in TOML column1 errorstrict mode: fields in the document are missing in the target struct file/etc/containerd/config.toml keyplugin_dir row4 WARN[0000] Configuration migrated from version 2, use containerd config migrate to avoid migration t45.839µs WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keydisable_cgroup pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keysystemd_cgroup pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keycontainerd no_pivot pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keycontainerd default_runtime pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keycontainerd default_runtime options pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keycontainerd runtimes runc runtime_engine pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keycontainerd runtimes runc runtime_root pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin errorstrict mode: fields in the document are missing in the target struct keycontainerd untrusted_workload_runtime pluginio.containerd.cri.v1.runtime WARN[0000] Ignoring unknown key in TOML for plugin