• 安装 containerd
    • " level="2">二进制部署

    安装 containerd

    " class="reference-link">二进制部署

    下载二进制:

    1. wget -q --show-progress --https-only --timestamping \
    2. https://github.com/opencontainers/runc/releases/download/v1.0.0-rc8/runc.amd64 \
    3. https://github.com/containerd/containerd/releases/download/v1.3.0/containerd-1.3.0.linux-amd64.tar.gz \
    4. https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.16.1/crictl-v1.16.1-linux-amd64.tar.gz
    5. sudo mv runc.amd64 runc

    安装二进制:

    1. tar -xvf crictl-v1.16.1-linux-amd64.tar.gz
    2. chmod +x crictl runc
    3. sudo cp crictl runc /usr/local/bin/
    4. mkdir containerd
    5. tar -xvf containerd-1.3.0.linux-amd64.tar.gz -C containerd
    6. sudo cp containerd/bin/* /bin/

    创建 containerd 启动配置 config.toml:

    1. sudo mkdir -p /etc/containerd/
    2. cat << EOF | sudo tee /etc/containerd/config.toml
    3. [plugins]
    4. [plugins.cri.containerd]
    5. snapshotter = "overlayfs"
    6. [plugins.cri.containerd.default_runtime]
    7. runtime_type = "io.containerd.runtime.v1.linux"
    8. runtime_engine = "/usr/local/bin/runc"
    9. runtime_root = ""
    10. EOF

    创建 systemd 配置 containerd.service:

    1. cat <<EOF | sudo tee /etc/systemd/system/containerd.service
    2. [Unit]
    3. Description=containerd container runtime
    4. Documentation=https://containerd.io
    5. After=network.target
    6. [Service]
    7. ExecStartPre=/sbin/modprobe overlay
    8. ExecStart=/bin/containerd
    9. Restart=always
    10. RestartSec=5
    11. Delegate=yes
    12. KillMode=process
    13. OOMScoreAdjust=-999
    14. LimitNOFILE=1048576
    15. LimitNPROC=infinity
    16. LimitCORE=infinity
    17. [Install]
    18. WantedBy=multi-user.target
    19. EOF

    启动:

    1. sudo systemctl daemon-reload
    2. sudo systemctl enable containerd
    3. sudo systemctl start containerd

    配置 crictl (方便后面使用 crictl 管理与调试 containerd 的容器与镜像):

    1. crictl config runtime-endpoint unix:///var/run/containerd/containerd.sock