我要评分
获取效率
正确性
完整性
易理解

Installing containerd

Install containerd on the management and compute nodes.

Procedure

  1. Clone the containerd source package.
    1
    git clone https://github.com/containerd/containerd -b release/1.4
    
  2. Initialize the directory module.
    1
    2
    cd containerd
    go mod init github.com/containerd/containerd
    

  3. Add missing modules and delete unnecessary modules.
    1
    go mod tidy
    
  4. Download dependencies to the project.
    go mod vendor
  5. Compile the source code.
    1
    make
    

  6. Install containerd.
    1
    make install
    

  7. Configure systemd.
    1
    2
    3
    4
    mkdir -p /usr/local/lib/systemd/system/
    cp containerd.service /usr/local/lib/systemd/system/containerd.service
    systemctl daemon-reload
    systemctl enable --now containerd
    

  8. Create a default containerd configuration file and configure cgroup.

    Modify the sandbox_image parameter. Otherwise, you may fail to pull images.

    1. Create a default containerd configuration file.
      1
      2
      mkdir -p /etc/containerd
      containerd config default > /etc/containerd/config.toml
      
    2. Set the cgroup and sandbox_image parameters.
      1. Open the /etc/containerd/config.toml file.
        1
        vi /etc/containerd/config.toml
        
      2. Press i to enter the insert mode. In the /etc/containerd/config.toml file, change sandbox_image under the [plugins."io.containerd.grpc.v1.cri"] field to the following information:
        1
        sandbox_image="registry.aliyuncs.com/google_containers/pause:3.2"
        
      3. Under the [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] field, add the following information to complete the cgroup configuration:
        1
        SystemdCgroup = true
        

        Modification result:

      4. Press Esc, type :wq!, and press Enter to save the file and exit.
      5. Restart containerd to make the new configuration take effect.
        1
        sudo systemctl restart containerd