华为鲲鹏麒麟安装containerd

一、安装containerd的先决的条件

cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# 设置必需的 sysctl 参数,这些参数在重新启动后仍然存在。
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

# 应用 sysctl 参数而无需重新启动
sudo sysctl --system

二、安装containerd

参考官网地址:https://github.com/containerd/containerd

下载containerd ARM版 我选的是1.6.0 

下载地址是:https://github.com/containerd/containerd/releases/download/v1.6.0/containerd-1.6.0-linux-arm64.tar.gz

上传到服务器解压到/usr/local/下

tar -zxvf containerd-1.6.0-linux-arm64.tar.gz -C /usr/local/

创建相应的目录

mkdir /etc/containerd

生成的默认配置文件

containerd config default> /etc/containerd/config.toml

修改配置文件

sed -i "s#k8s.gcr.io/pause:3.2#registry.aliyuncs.com/google_containers/pause:3.6#g" /etc/containerd/config.toml

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
  ...
  [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
    SystemdCgroup = true

 

 

配置containerd服务 参考https://github.com/containerd/containerd/blob/main/containerd.service地址

vim /usr/lib/systemd/system/containerd.service

# Copyright The containerd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd

Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target

启动服务

[root@ecs-arm-ky-003 ~]# systemctl enable containerd
[root@ecs-arm-ky-003 ~]# systemctl start containerd
[root@ecs-arm-ky-003 ~]# systemctl status containerd
● containerd.service - containerd container runtime
   Loaded: loaded (/usr/lib/systemd/system/containerd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-03-30 22:37:14 CST; 8s ago
     Docs: https://containerd.io
  Process: 6741 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 6743 (containerd)
    Tasks: 9
   Memory: 22.3M
   CGroup: /system.slice/containerd.service
           └─6743 /usr/local/bin/containerd

Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.493840223+08:00" level=info msg=serving... address=/run/containerd/containerd.sock.ttrpc
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.493883563+08:00" level=info msg=serving... address=/run/containerd/containerd.sock
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.493931984+08:00" level=info msg="containerd successfully booted in 0.029548s"
Mar 30 22:37:14 ecs-arm-ky-003 systemd[1]: Started containerd container runtime.
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.501938402+08:00" level=info msg="Start subscribing containerd event"
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.502427106+08:00" level=info msg="Start recovering state"
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.502525827+08:00" level=info msg="Start event monitor"
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.502546498+08:00" level=info msg="Start snapshots syncer"
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.502559648+08:00" level=info msg="Start cni network conf syncer for default"
Mar 30 22:37:14 ecs-arm-ky-003 containerd[6743]: time="2022-03-30T22:37:14.502569768+08:00" level=info msg="Start streaming server"

 三、安装crictl

安装crictl 参考:https://github.com/kubernetes-sigs/cri-tools

下载地址:https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.20.0/crictl-v1.20.0-linux-arm64.tar.gz

tar xvf crictl-v1.20.0-linux-arm64.tar -C /usr/local/bin/

cat > /etc/crictl.yaml <<EOF
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
debug: false
EOF
crictl config runtime-endpoint unix:/run/containerd/containerd.sock

[root@ecs-arm-ky-003 ~]# crictl pull nginx
Image is up to date for sha256:fd3d31a07ae69fb788a579676d2c5f4c3dd201f57bcd6c174cd0bd6475886f23
[root@ecs-arm-ky-003 ~]# crictl images
IMAGE                     TAG                 IMAGE ID            SIZE
docker.io/library/nginx   latest              fd3d31a07ae69       55.4MB

  四、安装runc

下载地址:https://github.com/opencontainers/runc/releases/download/v1.1.1/runc.arm64

wget https://github.com/opencontainers/runc/releases/download/v1.1.1/runc.arm64
chmod +x runc.arm64
./runc.arm64
mv runc.arm64 /usr/bin/runc
runc

 

posted @ 2022-03-30 22:47  丶蜡笔小兴  阅读(802)  评论(0编辑  收藏  举报