kubernete入门(一)
需要安装 cri-docker
因为 1.24 版本后移除了这个服务, 所以要单独安装上
cri-dockerd is a project based on the legacy built-in Docker Engine support that was removed from the kubelet in version 1.24.
- 安装方式推荐源码安装, 虽然github 有 release 版本, 那个是可执行文件, 并没加入到系统服务
apt install golang-go
git clone https://github.com/Mirantis/cri-dockerd.git
cd cri-dockerd
mkdir bin
cd src && go get && go build -o ../bin/cri-dockerd
cd ..
# Run these commands as root
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
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket
node 节点加入集群问题
由于没有cri-docker 需要指定 –cri-socket 报错显示:
[root@node02 ~]# kubeadm join 172.16.0.10:6443 --token ylhehd.v3orja12078tmls5 --discovery-token-ca-cert-hash sha256:838fa3d376985973707d7b2f00d389f65d08c11ffcb52a010af53fef2c9b2349
Found multiple CRI endpoints on the host. Please define which one do you wish to use by setting the 'criSocket' field in the kubeadm configuration file: unix:///var/run/containerd/containerd.sock, unix:///var/run/cri-dockerd.sock
To see the stack trace of this error execute with --v=5 or higher
解决方案:
kubeadm join 172.16.0.10:6443 --token ylhehd.v3orja12078tmls5 --discovery-token-ca-cert-hash sha256:838fa3d376985973707d7b2f00d389f65d08c11ffcb52a010af53fef2c9b2349 --cri-socket unix:///var/run/cri-dockerd.sock