从kubernetes1.24开始的版本移除了内置的docker支持,用户可以自行选择需要使用的容器运行时,比如containerd、CRI-O、Docker Engine等等,这里我们采用二进制安装的方式使用containerd作为kubernetes的容器运行时
CentOS 7.9
v1.6.19
mkdir -p /workspace/containerd
cd /workspace/containerd
wget https://github.com/containerd/containerd/releases/download/v1.6.19/containerd-1.6.19-linux-amd64.tar.gz
wget https://github.com/containerd/nerdctl/releases/download/v1.2.1/nerdctl-1.2.1-linux-amd64.tar.gz
wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
wget https://github.com/opencontainers/runc/releases/download/v1.1.4/runc.amd64
wget https://github.com/containernetworking/plugins/releases/download/v1.2.0/cni-plugins-linux-amd64-v1.2.0.tgz
tar Cxzvf /usr/local containerd-1.6.19-linux-amd64.tar.gz
tar Cxzvvf /usr/local/bin nerdctl-1.2.1-linux-amd64.tar.gz
mkdir -p /usr/local/lib/systemd/system
cp containerd.service /usr/local/lib/systemd/system/containerd.service
systemctl daemon-reload
systemctl enable --now containerd
install -m 755 runc.amd64 /usr/local/sbin/runc
mkdir -p /opt/cni/bin
tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.2.0.tgz
mkdir -p /etc/containerd
containerd config default > /etc/containerd/config.toml
编辑生成好的默认配置文件
vim /etc/containerd/config.toml
将配置文件中SystemdCgroup
的值修改为true
,即SystemdCgroup = true
如下所示
[ plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options ]
SystemdCgroup = false
修改pause镜像源,将registry.k8s.io/pause:3.6
修改为registry.aliyuncs.com/google_containers/pause:3.6
[plugins."io.containerd.grpc.v1.cri"]
sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.6"
重启containerd,安装就完成了
systemctl restart containerd
拉取镜像到指定的命名空间
ctr -n k8s.io image pull registry.aliyuncs.com/google_containers/pause:3.6
重命名标签
ctr -n k8s.io i tag registry.aliyuncs.com/google_containers/pause:3.6 registry.k8s.io/pause:3.6
查看所有命名空间
ctr namespaces ls
查看指定命名空间的镜像
ctr --n k8s.io image ls
手机扫一扫
移动阅读更方便
你可能感兴趣的文章