搭建kubernetes 集群报错 /proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1

描述

搭建k8s 集群报错

[root@master ~]# kubeadm init --kubernetes-version=v1.19.0 --pod-network-cidr=10.244.0.0/16
W0302 02:18:41.583703   32386 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.19.0
[preflight] Running pre-flight checks
        [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 20.10.3. Latest validated version: 19.03
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables 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

解决方法

执行下面的脚本

echo "1" >/proc/sys/net/bridge/bridge-nf-call-iptables
[root@his ~]# kubeadm init --pod-network-cidr=192.168.0.0/16 --kubernetes-version=v1.25.0 --apiserver-advertise-address=192.168.8.109 [init] Using Kubernetes version: v1.25.0 [preflight] Running pre-flight checks [WARNING Hostname]: hostname "his" could not be reached [WARNING Hostname]: hostname "his": lookup his on 192.168.8.254:53: no such host error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR CRI]: container runtime is not running: output: E0714 18:14:51.757340 11481 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/containerd/containerd.sock: connect: no such file or directory\"" time="2023-07-14T18:14:51+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/containerd/containerd.sock: connect: no such file or directory\"" , error: exit status 1 [ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1 [ERROR KubeletVersion]: the kubelet version is higher than the control plane version. This is not a supported version skew and may lead to a malfunctional cluster. Kubelet version: "1.27.3" Control plane version: "1.25.0" [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
最新发布
07-15
根据您提供的命令输出,您在执行`kubeadm init`命令时遇到了一些错误。让我们逐个来解决这些问题: 1. [WARNING Hostname]: hostname "his" could not be reached [WARNING Hostname]: hostname "his": lookup his on 192.168.8.254:53: no such host 这个警告意味着您的主机名无法解析。您可以通过编辑`/etc/hosts`文件来解决此问题,并将`his`主机名映射到正确的IP地址。示例如下: ```shell sudo nano /etc/hosts ``` 在文件中添加以下行: ``` 192.168.8.109 his ``` 保存并关闭文件。 2. [ERROR CRI]: container runtime is not running: output: E0714 18:14:51.757340 11481 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/containerd/containerd.sock: connect: no such file or directory\"" 此错误指示容器运行时未运行。这可能是由于您的容器运行时(例如containerd)未正确安装或配置导致的。请确保您已按照正确的步骤安装和配置了容器运行时。您可以尝试重新安装或重新配置容器运行时来解决此问题。 3. [ERROR FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1 这个错误表示`/proc/sys/net/bridge/bridge-nf-call-iptables`文件的内容不是1。您可以通过运行以下命令来解决此问题: ```shell echo 1 | sudo tee /proc/sys/net/bridge/bridge-nf-call-iptables ``` 4. [ERROR KubeletVersion]: the kubelet version is higher than the control plane version. This is not a supported version skew and may lead to a malfunctional cluster. Kubelet version: "1.27.3" Control plane version: "1.25.0" 这个错误表示您的kubelet版本高于控制平面版本。这不是受支持的版本差异,并且可能导致集群功能异常。为了解决此问题,您需要确保kubelet和控制平面使用相同的Kubernetes版本。您可以尝试升级或降级kubelet版本,以与控制平面版本匹配。 请根据上述解决方案逐个解决问题,并尝试重新执行`kubeadm init`命令。如果问题仍然存在,请提供更多详细信息,以便我们能够更好地帮助您解决问题。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值