diff --git a/pkg/proxy/ipvs/proxier.go b/pkg/proxy/ipvs/proxier.go index 20fd8acca5..029f269d87 100644 --- a/pkg/proxy/ipvs/proxier.go +++ b/pkg/proxy/ipvs/proxier.go @@ -162,6 +162,8 @@ const sysctlRouteLocalnet = "net/ipv4/conf/all/route_localnet" const sysctlBridgeCallIPTables = "net/bridge/bridge-nf-call-iptables" const sysctlVSConnTrack = "net/ipv4/vs/conntrack" const sysctlConnReuse = "net/ipv4/vs/conn_reuse_mode" +const sysctlExpireNoDestConn = "net/ipv4/vs/expire_nodest_conn" +const sysctlExpireQuiescentTemplate = "net/ipv4/vs/expire_quiescent_template" const sysctlForward = "net/ipv4/ip_forward" const sysctlArpIgnore = "net/ipv4/conf/all/arp_ignore" const sysctlArpAnnounce = "net/ipv4/conf/all/arp_announce" @@ -321,6 +323,20 @@ func NewProxier(ipt utiliptables.Interface, } } + // Set the expire_nodest_conn sysctl we need for + if val, _ := sysctl.GetSysctl(sysctlExpireNoDestConn); val != 1 { + if err := sysctl.SetSysctl(sysctlExpireNoDestConn, 1); err != nil { + return nil, fmt.Errorf("can't set sysctl %s: %v", sysctlExpireNoDestConn, err) + } + } + + // Set the expire_quiescent_template sysctl we need for + if val, _ := sysctl.GetSysctl(sysctlExpireQuiescentTemplate); val != 1 { + if err := sysctl.SetSysctl(sysctlExpireQuiescentTemplate, 1); err != nil { + return nil, fmt.Errorf("can't set sysctl %s: %v", sysctlExpireQuiescentTemplate, err) + } + } + // Set the ip_forward sysctl we need for if val, _ := sysctl.GetSysctl(sysctlForward); val != 1 { if err := sysctl.SetSysctl(sysctlForward, 1); err != nil {