侧边栏壁纸
博主头像
里奥的博客博主等级

行动起来,活在当下

  • 累计撰写 24 篇文章
  • 累计创建 7 个标签
  • 累计收到 2 条评论

目 录CONTENT

文章目录

安装 Kubernetes 时遇到的问题

里奥
2023-12-09 / 0 评论 / 1 点赞 / 162 阅读 / 2540 字

1. 镜像没法下载

执行kubeadm init 时卡在了镜像pull的环节

解决方法: 使用代理,设置如下:

sudo systemctl set-environment HTTP_PROXY=192.168.3.80:7890  
sudo systemctl set-environment HTTPS_PROXY=192.168.3.80:7890
sudo systemctl restart containerd.service

其中192.168.3.80:7890 为我自己的proxy代理地址

参考链接:

2. containerd 配置文件不全

根据官方文档,在/etc/containerd/config.toml中找不到plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc 这项配置

解决方法: 执行以下命令,就可以生成了:

containerd config default | sudo tee /etc/containerd/config.toml

参考链接

3. nodes not found 错误

kubeadm init 失败,使用命令journalctl -xeu kubelet查看,发现有如下错误 error execution phase upload-config/kubelet: Error writing Crisocket information for the control-plane node: nodes "masternode-0" not found

解决方法: 由于使用代理pull镜像的原因,只要将代理去掉或者将其置为DIRECT模式即可

4. pod cidr not assigned 错误

应用网络插件flannel时,使用命令kubectl logs查看,发现POD有如下错误 Error registering network: failed to acquire lease: node "nodeName" pod cidr not assigned

解决方法: 执行以下命令:

kubectl patch node $(hostname) -p '{"spec":{"podCIDR":"10.244.0.0/16"}}'

其中10.244.0.0/16 值需要跟flannel的yaml的文件里一样的

同理,当join worker node 的时候,也需要指定这个podCIDR 参考链接

1

评论区