我正在运行 kubernetes 1.11.6 并遇到连接重置问题。对于以下博客的此修复,建议添加 iptables 规则。当我尝试添加规则时。它自动冲洗。我假设这是由 kube-proxy 完成的
iptables -I KUBE-FORWARD 1 -m conntrack --ctstate INVALID -j DROP
iptables -t filter -L KUBE-FORWARD --line-numbers -n
Chain KUBE-FORWARD (1 references)
num target prot opt source destination
1 DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 /* kubernetes forwarding rules */ mark match 0x4000/0x4000
3 ACCEPT all -- 10.42.0.0/16 0.0.0.0/0 /* kubernetes forwarding conntrack pod source rule */ ctstate RELATED,ESTABLISHED
4 ACCEPT all -- 0.0.0.0/0 10.42.0.0/16 /* kubernetes forwarding conntrack pod destination rule */ ctstate RELATED,ESTABLISHED
一段时间后,我看到它消失了。
iptables -t filter -L KUBE-FORWARD --line-numbers -n
Chain KUBE-FORWARD (1 references)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 /* kubernetes forwarding rules */ mark match 0x4000/0x4000
2 ACCEPT all -- 10.42.0.0/16 0.0.0.0/0 /* kubernetes forwarding conntrack pod source rule */ ctstate RELATED,ESTABLISHED
3 ACCEPT all -- 0.0.0.0/0 10.42.0.0/16 /* kubernetes forwarding conntrack pod destination rule */ ctstate RELATED,ESTABLISHED
我试图坚持以上规则。