搜索

安装Containerd


发布时间: 2022-11-24 17:42:05    浏览次数:12 次

官方说明文档

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

image
https://github.com/opencontainers/runc/releases
install -m 755 runc.amd64 /usr/local/sbin/runc
image

查看runc版本
runc -v
image

四、安装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为systemd
image
image

七、修改沙箱镜像地址

image

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

image

八、重启containerd

systemctl restart containerd

九、检查安装是否成功

ctr version
image

免责声明 安装Containerd,资源类别:文本, 浏览次数:12 次, 文件大小:-- , 由本站蜘蛛搜索收录2022-11-24 05:42:05。此页面由程序自动采集,只作交流和学习使用,本站不储存任何资源文件,如有侵权内容请联系我们举报删除, 感谢您对本站的支持。 原文链接:https://www.cnblogs.com/bangbangzoutianya/p/16805788.html