安装Containerd

官方说明文档

https://github.com/containerd/containerd/blob/main/docs/getting-started.md

一、下载containerd压缩包

https://github.com/containerd/containerd/releases/tag/v1.6.8

二、解压containerd-1.6.8-linux-amd64.tar.gz

# C 指定解压到XX目录
tar Cxzvf /usr/local containerd-1.6.8-linux-amd64.tar.gz

image

systemd 如果您打算通过systemd启动容器,您还应该下载

image

文档给出的地址打不开,下面是github地址
containerd.service地址:https://github.com/containerd/containerd/blob/main/containerd.service

  • 下载文件后,放到/usr/local/lib/systemd/system/containerd.service 下
  • 执行以下命令
# 如果没有目录就先创建
mkdir -p /usr/local/lib/systemd/system
cd /usr/local/lib/systemd/system
vim containerd.service

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]
#uncomment to enable the experimental sbservice (sandboxed) version of containerd/cri integration
#Environment="ENABLE_CRI_SANDBOXES=sandboxed"
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
  • 使服务生效
systemctl daemon-reload
systemctl enable --now containerd

三、安装runc

imagehttps://github.com/opencontainers/runc/releasesinstall -m 755 runc.amd64 /usr/local/sbin/runcimage

查看runc版本runc -vimage

四、安装CNI插件

image

mkdir -p /opt/cni/bin
tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.1.1.tgz

image

五、生成containerd配置文件

image

image

# 先创建目录
mkdir -p /etc/containerd
containerd config default > /etc/containerd/config.toml

image

六、配置 systemd cgroup 驱动

对于使用systemd作为init system的Linux的发行版,使用systemd作为容器的cgroup driver可以确保服务器节点在资源紧张的情况更加稳定,因此这里配置各个节点上containerd的cgroup driver为systemdimageimage

七、修改沙箱镜像地址

image

vim config.toml
# 快速查询sandbox
# 使用命令行 :/sandbox
# 修改地址为:registry.aliyuncs.com/google_containers/pause:3.7

image

八、重启containerd

systemctl restart containerd

九、检查安装是否成功

ctr versionimage

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值