k8s启动异常bridge-nf-call-iptables contents are not set to 1

异常信息

W0221 11:58:00.489737    6787 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
[init] Using Kubernetes version: v1.18.0
[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 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

分析原因

  • 网络设置错误,/proc/sys/net/bridge/bridge-nf-call-iptables 值应该设置为 1

解决方法

  • 将桥接的IPv4流量传递到iptables的链
cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
  • 使系统修改生效
sysctl --system
Logo

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

更多推荐