可以参考《Kubernetes IPVS模式下服务间长连接通讯的优化,解决Connection reset by peer问题》
先看节点的系统参数:
sysctl net.ipv4.tcp_keepalive_time net.ipv4.tcp_keepalive_probes net.ipv4.tcp_keepalive_intvl net.ipv4.tcp_keepalive_time = 7200 net.ipv4.tcp_keepalive_probes = 9 net.ipv4.tcp_keepalive_intvl = 75
再看ipvs参数
ipvsadm -l --timeout Timeout (tcp tcpfin udp): 900 120 300
当系统超时超过ipvs超时,就会发生问题,可能会导致reset bpeer
修改如下:
net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_keepalive_intvl = 30 net.ipv4.tcp_keepalive_probes = 10