kubernetes node节点加入容器 [ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forw

出现问题

出现这个问题的原因是我想kubernetes node节点想加入主节点
然后说是 /proc/sys/net/ipv4/ip_forward 文件没有设置成1

[root@zjj102 ~]# kubeadm join 172.16.10.101:6443 --token qnv1yd.t6md74mwcnty78uv     --discovery-token-ca-cert-hash sha256:13c8363f7beea0ee257730c981a501c222bc9a914c37331d07242149451f2f8f
W0228 13:36:38.965166   54276 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
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
[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

解决

输入 : sysctl -w net.ipv4.ip_forward=1 就可以解决这个问题了

[root@zjj102 ~]# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
[root@zjj102 ~]# kubeadm join 172.16.10.101:6443 --token qnv1yd.t6md74mwcnty78uv     --discovery-token-ca-cert-hash sha256:13c8363f7beea0ee257730c981a501c222bc9a914c37331d07242149451f2f8f
W0228 13:39:48.512234   55718 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
[preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
[kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.18" ConfigMap in the kube-system namespace
[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.
上一篇:Kubernetes Pod驱逐策略


下一篇:记录一次修复k8s pod长时间处于crashloopbackoff状态问题