Skip to content

Containerd v2.x version compatibility #871

@zhangzhuo0705

Description

@zhangzhuo0705

When I was deploying the Kubernetes cluster, I replaced the "disconnected_url" configuration. However, there was an error in the initialization script field generated by containerd.

My version of kcli

version: 99.0 commit: cced52e 2026/04/18 Available Updates: True

I initiated the command for creating the cluster.

kcli create cluster generic -P ctlplanes=1 -P workers=1 -P image=ubuntu2204 -P disconnected_url=registry.cn-hangzhou.aliyuncs.com/google_containers ceshi

Deploy the containerd script file generated by the control node

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y containerd || apt-get install -y containerd.io

mkdir -p /etc/containerd
containerd config default > /etc/containerd/config.toml
sed -i 's/SystemdCgroup = .*/SystemdCgroup = true/' /etc/containerd/config.toml


REGISTRY=registry.cn-hangzhou.aliyuncs.com/google_containers
REGISTRY_USER=dummy
REGISTRY_PASSWORD=dummy
KEY=$( echo -n $REGISTRY_USER:$REGISTRY_PASSWORD | base64)
sed -i "s%sandbox_image = .*%sandbox_image = \"$REGISTRY/pause:latest\"%" /etc/containerd/config.toml
sed -i 's%config_path = .*%config_path = "/etc/containerd/certs.d"%' /etc/containerd/config.toml
mkdir -p /etc/containerd/certs.d/_default
cat > /etc/containerd/certs.d/_default/hosts.toml << EOF
[host."https://$REGISTRY"]
  capabilities = ["pull", "resolve", "push"]
  skip_verify = true
  [host."https://$REGISTRY".header]
    authorization = "Basic $KEY"
EOF

systemctl enable --now containerd || systemctl daemon-reload
systemctl restart containerd

The configuration file generated by the containerd v2.x version

cat /etc/containerd/config.toml
    [plugins.'io.containerd.cri.v1.images'.pinned_images]
      sandbox = 'registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.10.1'

    [plugins.'io.containerd.cri.v1.images'.registry]
      config_path = "/etc/containerd/certs.d"

    [plugins.'io.containerd.cri.v1.images'.image_decryption]
      key_model = 'node'

The actual configuration file is inconsistent with the field for modifying the image repository in the containerd.sh script.

And I found that I couldn't use the "engine_version" to specify the version of containerd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions