Kubernetes nodes with kube-proxy in IPVS mode cause long-lived TCP connections to stall when conntrack entries exceed kernel limit
Environment
Self-managed Kubernetes cluster: kube-proxy running in IPVS mode on Debian 11 nodes, kernel 5.15. Cluster services with NodePort and ClusterIP; many short-lived and some long-lived TCP connections (WebSockets, SSH tunnels). Nodes handle ~200k concurrent ephemeral flows during peak.
Symptoms
Long-lived TCP connections (WebSocket sessions and long-poll HTTP) hang after several minutes to tens of minutes: client sees connection freeze though TCP stays ESTABLISHED; small/short requests continue to succeed. Restarting kube-proxy on an affected node immediately restores connectivity for connections routed via that node. New connections are accepted until the stall recurs.
Observations
On affected nodes /proc/sys/net/netfilter/nf_conntrack_count frequently approaches or reaches /proc/sys/net/netfilter/nf_conntrack_max around the time stalls start. dmesg occasionally shows 'nf_conntrack: table full, dropping packet' and 'xt_conntrack: expect entry without conntrack' messages. ipvsadm -L shows many entries but not excessive CPU utilization on nodes. Increasing nf_conntrack_max from 65536 to 200000 reduced stall frequency but did not eliminate them. conntrack -L shows many connections in UNREPLIED or ESTABLISHED states with large durations.
Already attempted
Raised nf_conntrack_max and tuned nf_conntrack_tcp_timeout_established from default to a shorter timeout as an experiment (reversible sysctl changes). Temporarily switched a test node to kube-proxy iptables mode to validate; iptables node did not exhibit the same stalls under similar load. Performed kube-proxy rollout (restart) on two nodes which temporarily cleared the issue. Enabled conntrack monitoring (exporter) to track trend.
Question
Given the evidence of conntrack table saturation and IPVS-specific behavior, what diagnostic steps and configuration changes should I apply to determine whether this is conntrack table exhaustion, an IPVS conntrack bug, or kube-proxy misconfiguration, and what safe mitigations can I apply without a large cluster-wide restart?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags