Closed panpan0000 closed 4 years ago
Hello everyone: We are very fortunate to tell you that this bug has been fixed by us and has been verified to work very well. The patch(ipvs: avoid drop first packet by reusing conntrack) is being submitted to the Linux kernel community. You can also apply this patch to your own kernel, and then only need to set net.ipv4.vs.conn_reuse_mode=1(default) and net.ipv4.vs.conn_reuse_old_conntrack=1(default). As the net.ipv4.vs.conn_reuse_old_conntrack sysctl switch is newly added. You can adapt the kube-proxy by judging whether there is net.ipv4.vs.conn_reuse_old_conntrack, if so, it means that the current kernel is the version that fixed this bug. That Can solve the following problems:
host -> service IP -> pod
when upgrading from 1.15.3 -> 1.18.1
on RHEL 8.1 #90854
https://github.com/kubernetes/kubernetes/issues/90854kube-proxy ipvs conn_reuse_mode setting causes errors with high load from single client #81775 https://github.com/kubernetes/kubernetes/issues/81775
Thank you. By Yang Yuxi (TencentCloudContainerTeam)
Following-up on @yyx's comment above for posterity.
The above patch mentioned in https://github.com/aledbf/kube-keepalived-vip/pull/109#issuecomment-642705904 didn't make it to the kernel but there are two recently merged patches worth highlighting. One of them fixes the 1 second delay issue when a conntrack entry is reused and the other fixes an issue where packets are dropped when stale connection entries in the IPVS table are used: 1) http://patchwork.ozlabs.org/project/netfilter-devel/patch/20200701151719.4751-1-ja@ssi.bg/ 2) http://patchwork.ozlabs.org/project/netfilter-devel/patch/20200708161638.13584-1-kim.andrewsy@gmail.com/
This is to address the performance issue. when stressing the VIP:port , the response latency will become 1 second long after a while, and looping. below is the jMeter response time diagram, you will see the response time become 1s and last ~30 s. (using
ab
to stress will see the same thing)This is a known situation in kubernetes community, resolution is to disabling
net/ipv4/vs/conn_reuse_mode
, which kube-proxy does the same way in IPVS mode.reference: https://github.com/kubernetes/kubernetes/issues/70747 https://github.com/cloudnativelabs/kube-router/issues/544