运行 kubeadm init --config kubeadm.yaml 完整报错如下:
[root@m1 ~]# kubeadm init --config kubeadm.yaml
[init] Using Kubernetes version: v1.25.0
[preflight] Running pre-flight checks
[WARNING Hostname]: hostname "node" could not be reached
[WARNING Hostname]: hostname "node": lookup node on 114.114.114.114:53: no such host
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR CRI]: container runtime is not running: output: E1012 16:05:21.590596 13160 remote_runtime.go:948] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
time="2022-10-12T16:05:21+08:00" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
解决:
[root@m1:~] rm -rf /etc/containerd/config.toml
[root@m1:~] systemctl restart containerd
注意:kubernetes 1.24+版本之后,docker必须要加装cir-docker文章来源:https://www.toymoban.com/news/detail-517143.html
安装 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使用文章来源地址https://www.toymoban.com/news/detail-517143.html
- 需要追加–network-plugin=cni,通过该配置告诉容器,使用kubernetes的网络接口。
vim /etc/systemd/system/cri-docker.service
# 追加
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 docker
systemctl start cri-docker
# 验证
systemctl status cri-docker
到了这里,关于Kubeadm初始化遇到的坑:[ERROR CRI]: container runtime is not running:的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!