配置网络转发

配置网络转发 #

# For Ubuntu & CentOS
$ cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
overlay
br_netfilter
EOF

$ modprobe overlay && modprobe br_netfilter

# 设置启动配置
$ cat > /etc/sysctl.d/k8s.conf << EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
vm.swappiness = 0
EOF

$ sysctl -p /etc/sysctl.d/k8s.conf