当前位置:首页 » 《随便一记》 » 正文

记【k8s】节点kubeadm join报错:[ERROR FileContent--proc-sys-net-ipv4-ip_forward]

25 人参与  2024年04月16日 15:21  分类 : 《随便一记》  评论

点击全文阅读


记【k8s】节点kubeadm join报错:[ERROR FileContent--proc-sys-net-ipv4-ip_forward]

1、报错一、kubeadm join报错:[ERROR FileContent--proc-sys-net-ipv4-ip_forward]1、报错详情2、报错解决3、重新运行 kubeadm join 命令以加入 Kubernetes 集群 2、报错二、[ERROR CRI]: container runtime is not running: output: E0403 18:04:53.2196121、报错详情2、报错解决3、重新运行 kubeadm join 命令以加入 Kubernetes 集群


?The Begin?点点关注,收藏不迷路?

1、报错一、kubeadm join报错:[ERROR FileContent–proc-sys-net-ipv4-ip_forward]

1、报错详情

[root@k8s-node01 local]# kubeadm join k8s-master:6443 --token lad5yi.ib6gterchvmkw2xd         --discovery-token-ca-cert-hash sha256:eb567a446cd6a0d79da694f4ab23b5c7bf2be4df86f4aecfadef07716fbabd2b         --cri-socket unix:///var/run/cri-dockerd.sock[preflight] Running pre-flight checkserror execution phase preflight: [preflight] Some fatal errors occurred:[ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 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@k8s-node01 local]#

2、报错解决

这个错误提示显示了一个预检错误,指出 /proc/sys/net/ipv4/ip_forward 的内容未设置为 1。在 Kubernetes 的预安装检查中,这是一个必要的设置,它允许数据包在节点之间进行转发。

要解决这个问题,需要设置 /proc/sys/net/ipv4/ip_forward 的值为 1。

编辑 /etc/sysctl.conf 文件并确保以下行存在:

net.ipv4.ip_forward = 1

保存并退出文件,然后运行以下命令使更改生效:

sysctl -p

3、重新运行 kubeadm join 命令以加入 Kubernetes 集群

[root@k8s-node01 ~]# kubeadm join k8s-master:6443 --token lad5yi.ib6gterchvmkw2xd \>         --discovery-token-ca-cert-hash sha256:eb567a446cd6a0d79da694f4ab23b5c7bf2be4df86f4aecfadef07716fbabd2b \>         --cri-socket unix:///var/run/cri-dockerd.sock[preflight] Running pre-flight checks[preflight] Reading configuration from the cluster...[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"[kubelet-start] Starting the kubelet[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...This node has joined the cluster:* Certificate signing request was sent to apiserver and a response was received.* The Kubelet was informed of the new secure connection details.Run 'kubectl get nodes' on the control-plane to see this node join the cluster.[root@k8s-node01 ~]# 

在这里插入图片描述
在这里插入图片描述

2、报错二、[ERROR CRI]: container runtime is not running: output: E0403 18:04:53.219612

1、报错详情

[root@k8s-node01 ~]# kubeadm join k8s-master:6443 --token uf3sgs.ps01p9uoukky3rgp \> --discovery-token-ca-cert-hash sha256:a62bb47d0320336c4a558ab91763516e2f0f1cb80e1ab5d96f69ec82237a5653 \> --cri-socket unix:///var/run/cri-dockerd.sock[preflight] Running pre-flight checkserror execution phase preflight: [preflight] Some fatal errors occurred:[ERROR CRI]: container runtime is not running: output: E0403 18:04:53.219612    4260 remote_runtime.go:616] "Status from runtime service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory\""time="2024-04-03T18:04:53+08:00" level=fatal msg="getting status of runtime: rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/cri-dockerd.sock: connect: no such file or directory\"", 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

2、报错解决

1、查看containerd状态

systemctl status containerd

在这里插入图片描述

2、编辑vim /etc/containerd/config.toml 文件

vim /etc/containerd/config.toml
将disabled_plugins = ["cri"]注释该行或将"cri"删掉

在这里插入图片描述

3、重启containerd

修改的内容重启后生效

systemctl restart containerd

3、重新运行 kubeadm join 命令以加入 Kubernetes 集群

[root@k8s-node02 ~]# kubeadm join k8s-master:6443 --token uf3sgs.ps01p9uoukky3rgp \> --discovery-token-ca-cert-hash sha256:a62bb47d0320336c4a558ab91763516e2f0f1cb80e1ab5d96f69ec82237a5653[preflight] Running pre-flight checks[preflight] Reading configuration from the cluster...[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"[kubelet-start] Starting the kubelet[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...This node has joined the cluster:* Certificate signing request was sent to apiserver and a response was received.* The Kubelet was informed of the new secure connection details.Run 'kubectl get nodes' on the control-plane to see this node join the cluster.[root@k8s-node02 ~]# 

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述


?The End?点点关注,收藏不迷路?

点击全文阅读


本文链接:http://zhangshiyu.com/post/96104.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1