Set TCP keepalive timeouts for cluster network

The TCP keepalive timeouts in pods running on the cluster
network are currently set to the following:
net.ipv4.tcp_keepalive_intvl = 75
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_time = 7200

This means that a dropped TCP connection can take more than
two hours to be removed. That can cause large delays in reacting
to unexpected events like the uncontrolled reboot of a host.

This commit changes the TCP keepalive timeouts for the cluster
network to match the timeouts for the host OS:
net.ipv4.tcp_keepalive_intvl = 1
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_time = 5

Change-Id: I23e2c9a733727e4059ac272e052dca0e6ec4f2e1
Closes-bug: 1836232
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
This commit is contained in:
Bart Wensley
2019-07-15 07:03:46 -05:00
parent 93cd5b250a
commit 9a4b6b6a5d

View File

@@ -6,8 +6,8 @@
# #
# - The multus CNI configuration file has been explicitly specified to ensure # - The multus CNI configuration file has been explicitly specified to ensure
# it has a lower lexographic order than the calico CNI configuration file. # it has a lower lexographic order than the calico CNI configuration file.
#
# - The configMap has been modified to work with Calico rather than Flannel # - The configMap has been modified to work with Calico rather than Flannel
# - The tuning plugin is used to update sysctl tcp_keepalive timers.
--- ---
apiVersion: apiextensions.k8s.io/v1beta1 apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition kind: CustomResourceDefinition
@@ -83,6 +83,10 @@ data:
"name": "multus-cni-network", "name": "multus-cni-network",
"type": "multus", "type": "multus",
"delegates": [ "delegates": [
{
"cniVersion": "0.3.0",
"name": "chain",
"plugins": [
{ {
"cniVersion": "0.3.0", "cniVersion": "0.3.0",
"name": "k8s-pod-network", "name": "k8s-pod-network",
@@ -103,6 +107,17 @@ data:
"kubernetes": { "kubernetes": {
"kubeconfig": "/etc/cni/net.d/calico-kubeconfig" "kubeconfig": "/etc/cni/net.d/calico-kubeconfig"
} }
},
{
"name": "sysctl-tuning",
"type": "tuning",
"sysctl": {
"net.ipv4.tcp_keepalive_intvl": "1",
"net.ipv4.tcp_keepalive_probes": "5",
"net.ipv4.tcp_keepalive_time": "5"
}
}
]
} }
], ],
"kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig" "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig"