Containerd安装及配置
Containerd
网络仓库安装
apt,Debian版本更新会比较慢,Ubuntu版本更新比较快
apt install -y containerd
yum
依赖于 Dokcer ,导入 Docker 仓库,仅安装 containerd 即可
yum install -y containerd.io
二进制安装
containerd/docs/getting-started.md
安装 containerd
release=1.7.11
wget -c https://mirror.ghproxy.com/https://github.com/containerd/containerd/releases/download/v${release}/containerd-${release}-linux-amd64.tar.gz
tar Cvxf /usr/local containerd-${release}-linux-amd64.tar.gz
配置服务
# 直接 -P 指定路径也行
wget -c https://mirror.ghproxy.com/https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
cp containerd.service /usr/lib/systemd/system/containerd.service
# 加载服务
systemctl daemon-reload
systemctl enable --now containerd
安装 runc
release=1.1.11
wget -c https://mirror.ghproxy.com/https://github.com/opencontainers/runc/releases/download/v${release}/runc.amd64
install -m 755 runc.amd64 /usr/local/sbin/runc
安装 CNI 组件
release=1.4.0
wget -c https://mirror.ghproxy.com/https://github.com/containernetworking/plugins/releases/download/v${release}/cni-plugins-linux-amd64-v${release}.tgz
mkdir -p /opt/cni/bin
tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v${release}.tgz
containerd 管理工具
-
ctr 原生api,默认管理工具
ctr images pull docker.io/library/redis:alpine ctr run docker.io/library/redis:alpine redis
-
nerdctl 原生api,参考文档 GitHub - containerd/nerdctl
nerdctl run --name redis redis:alpine
-
crictl CRI 接口,参考文档 cri-tools/docs/crictl.md at master · kubernetes-sigs/cri-tools · GitHub
release="v1.29.0" wget -c https://mirror.ghproxy.com/https://github.com/kubernetes-sigs/cri-tools/releases/download/${release}/crictl-${release}-linux-amd64.tar.gz tar zxvf crictl-${release}-linux-amd64.tar.gz -C /usr/local/bin rm -f crictl-${release}-linux-amd64.tar.gz
containerd 配置
-
如果没有没有,手动生成一个
containerd config default > /etc/containerd/config.toml
-
修改镜像加速
/etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors] [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"] endpoint = ["https://kuamavit.mirror.aliyuncs.com", "https://registry-1.docker.io"]
-
修改sandbox
/etc/containerd/config.toml
sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.9"
-
改为配置,重启服务
systemctl restart containerd
本文来自博客园,作者:虫祇,转载请注明原文链接:https://www.cnblogs.com/chongxs/p/18098005/containerd