kubeadm初始化报错如下:

[root@ECS-k8s-master docker]# kubeadm init   --apiserver-advertise-address=192.168.2.2 --image-repository registry.aliyuncs.com/google_containers   --kubernetes-version v1.24.2   --service-cidr=10.140.0.0/16 --pod-network-cidr=10.240.0.0/16
[init] Using Kubernetes version: v1.24.2
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
  [ERROR CRI]: container runtime is not running: output: E0704 14:55:48.132984    5226 remote_runtime.go:925] "Status from runtime service failed"err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
time="2022-07-04T14:55:48+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

网上查询光说让删除

rm /etc/containerd/config.toml

但其实,删除完后要重启 containerd 服务,不然不生效

完整如下:

rm /etc/containerd/config.toml
systemctl restart containerd

报错二

[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s

kubeadm init \
--apiserver-advertise-address=10.1.1.1 \
--control-plane-endpoint=master \   这里用的是主机名,必须再 /etc/hosts 里有
--image-repository registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images \
--kubernetes-version v1.21.0 \
--service-cidr=10.96.0.0/16 \
--pod-network-cidr=192.168.0.0/16

我上面遇到的报错就是 master 主机名不对导致连不上

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐