调整k8s的iptable参数时启动生效报错

sysctl -p /etc/sysctl.d/kubernetes.conf

报错如下:

net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1
net.ipv4.tcp_tw_recycle = 0
vm.swappiness = 0
vm.overcommit_memory = 1
vm.panic_on_oom = 0
fs.inotify.max_user_instances = 8192
fs.inotify.max_user_watches = 1048576
fs.file-max = 52706963
fs.nr_open = 52706963
net.ipv6.conf.all.disable_ipv6 = 1
sysctl: cannot stat /proc/sys/net/netfilter/nf_conntrack_max: No such file or directory

可能是 conntrack没有加载

lsmod |grep conntrack 返回为空表示没有加载

modprobe ip_conntrack

再查就有了

[root@k8sNode1 local]# lsmod |grep conntrack
nf_conntrack_ipv4      20480  0
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4
nf_conntrack          114688  1 nf_conntrack_ipv4

再次执行之前的语句即可

Logo

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

更多推荐