Skip to content

Commit 33810a9

Browse files
committed
cluster: ipvs conntrack module vs kernel version
We should use 'nf_conntrack' instead of 'nf_conntrack_ipv4' for linux kernel >= 4.19
1 parent b6f1138 commit 33810a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cluster/gce/gci/configure-helper.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,15 @@ function prepare-kube-proxy-manifest-variables {
14971497
params+=" --feature-gates=${FEATURE_GATES}"
14981498
fi
14991499
if [[ "${KUBE_PROXY_MODE:-}" == "ipvs" ]];then
1500-
sudo modprobe -a ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh nf_conntrack_ipv4
1500+
# use 'nf_conntrack' instead of 'nf_conntrack_ipv4' for linux kernel >= 4.19
1501+
# https://github.com/kubernetes/kubernetes/pull/70398
1502+
local -r kernel_version=$(uname -r | cut -d\. -f1,2)
1503+
local conntrack_module="nf_conntrack"
1504+
if [[ $(printf "${kernel_version}\n4.18\n" | sort -V | tail -1) == "4.18" ]]; then
1505+
conntrack_module="nf_conntrack_ipv4"
1506+
fi
1507+
1508+
sudo modprobe -a ip_vs ip_vs_rr ip_vs_wrr ip_vs_sh ${conntrack_module}
15011509
if [[ $? -eq 0 ]];
15021510
then
15031511
params+=" --proxy-mode=ipvs"

0 commit comments

Comments
 (0)