首页 新闻 搜索 专区 学院

将服务器作为 control-plane 加入 k8s 集群时 pre-flight checks 失败

0
悬赏园豆:30 [已解决问题] 解决于 2022-05-20 15:18

kubeadm join 命令的错误信息如下,请问如何解决?

[preflight] Running pre-flight checks
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 does not exist
	[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=...`
k8s
dudu的主页 dudu | 高人七级 | 园豆:36444
提问于:2022-05-19 17:21
< >
分享
最佳答案
0

通过 https://github.com/kubernetes/kubeadm/issues/1062 找到了解决方法,需要根据官方文档 Forwarding IPv4 and letting iptables see bridged traffic 执行下面的命令

cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

sudo modprobe overlay
sudo modprobe br_netfilter

# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-iptables  = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward                 = 1
EOF

# Apply sysctl params without reboot
sudo sysctl --system
dudu | 高人七级 |园豆:36444 | 2022-05-20 15:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册