cri-dockerd
为 Docker 提供了一个 shim,这样就可以通过 Kubernetes Container Runtime Interface(kubernetes容器运行时接口) 控制 Docker 了。
go安装
构建cri-dockerd
git clone https://github.com/Mirantis/cri-dockerd.git
编译
cd cri-dockerd
mkdir bin
go build -o bin/cri-dockerd
mkdir -p /usr/local/bin
install -o root -g root -m 0755 bin/cri-dockerd /usr/local/bin/cri-dockerd
cp -a packaging/systemd/* /etc/systemd/system
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
Kubernetes使用
1、需要追加--network-plugin=cni
,通过该配置告诉容器,使用kubernetes的网络接口。
2、覆盖沙盒 (pause) 镜像,正常情况下,国内你是拉取不到k8s.gcr.io/pause:3.8
镜像的,可以换成国内的kubebiz/pause:3.8
,这个镜像是一切的 Pod 的基础,要么自己手动导入进来,要么改成国内的镜像,通过设置以下配置来覆盖默认的沙盒镜像:
编辑:
vim /etc/systemd/system/cri-docker.service
将这1、2个步骤的参数,在ExecStart后面追加,如:
ExecStart=/usr/local/bin/cri-dockerd --container-runtime-endpoint fd:// --network-plugin=cni --pod-infra-container-image=kubebiz/pause:3.8
启动
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket
systemctl start cri-docker
验证
systemctl status cri-docker
返回:
● cri-docker.service - CRI Interface for Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/cri-docker.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022-08-10 19:45:28 CST; 4s ago
Docs: https://docs.mirantis.com
Main PID: 2079 (cri-dockerd)
Tasks: 5
Memory: 14.8M
CGroup: /system.slice/cri-docker.service
└─2079 /usr/local/bin/cri-dockerd --container-runtime-endpoint fd:// --network-plugin=cni --pod-infra-container-image=kubebiz/pause:3.8
确认安装成功。
相关连接
原文:https://github.com/Mirantis/cri-dockerd
二进制文件下载地址: https://github.com/Mirantis/cri-dockerd/releases
git clone https://github.com/Mirantis/cri-dockerd.git
这个下载是不是换了呢
git 不到了
可以呀,github网络不稳定吧