Installing containerd
Install containerd on the management and compute nodes.
Procedure
- Clone the containerd source package.
1git clone https://github.com/containerd/containerd -b release/1.4
- Initialize the directory module.
1 2
cd containerd go mod init github.com/containerd/containerd

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

- Install containerd.
1make install
- 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

- Create a default containerd configuration file and configure cgroup.
Modify the sandbox_image parameter. Otherwise, you may fail to pull images.
- Create a default containerd configuration file.
1 2
mkdir -p /etc/containerd containerd config default > /etc/containerd/config.toml
- Set the cgroup and sandbox_image parameters.
- Open the /etc/containerd/config.toml file.
1vi /etc/containerd/config.toml - 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:
1sandbox_image="registry.aliyuncs.com/google_containers/pause:3.2"
- Under the [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] field, add the following information to complete the cgroup configuration:
1SystemdCgroup = true
Modification result:

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Restart containerd to make the new configuration take effect.
1sudo systemctl restart containerd
- Open the /etc/containerd/config.toml file.
- Create a default containerd configuration file.
Parent topic: Deploying the Kubernetes Cluster