Rate This Document
Findability
Accuracy
Completeness
Readability

Installing containerd

Install containerd on the management and compute nodes.

Procedure

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

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

  6. Install containerd.
    make install

  7. Configure systemd.
    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.
      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.
        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:
        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:
        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.
        sudo systemctl restart containerd