报错:[ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1
#初始化k8s
[root@k8s154 ~]# kubeadm init --kubernetes-version=v1.19.9 --image-repository registry.aliyuncs.com/google_containers --pod-netwo254.0.0/16
W1207 19:33:37.394954 15092 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config
[init] Using Kubernetes version: v1.19.9
[preflight] Running pre-flight checks
[WARNING Hostname]: hostname "k8s154" could not be reached
[WARNING Hostname]: hostname "k8s154": lookup k8s154 on 223.5.5.5:53: no such host
error 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 #此处报错显示确实iptables桥接流量的检查
[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
翻译:
错误执行阶段预检:[preflight]发生了一些致命错误:
[错误文件内容--proc-sys-net-ipv4-ip_forward]:/proc/sys/net/ipv4/ip_forward内容未设置为1#此处报错显示确实iptables(iptables)桥接流量的检查
[preflight]如果你知道你在做什么,你可以用`--ignore preflight errors=`
要查看此错误的堆栈跟踪,请使用--v=5或更高版本执行
解决方法:
允许iptable检查桥接流量
cat <<EOF | tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
cat <<EOF | tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --system
标签:--,ip,sys,ipv4,forward,net,proc
From: https://www.cnblogs.com/zouyu7799/p/16964361.html