From 09a2e49a94aeef7162d5874a663aea7930976d2f Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Wed, 13 Feb 2019 21:56:38 +0200 Subject: [PATCH] kubeadm: fix RequiredIPVSKernelModulesAvailable warning message RequiredIPVSKernelModulesAvailable warning confuses users suggesting that the IPVS proxier will not be used, which is not always the case. Made the warning message less confusing: [WARNING RequiredIPVSKernelModulesAvailable]: The IPVS proxier may not be used because the following required kernel modules are not loaded: [ip_vs_rr ip_vs_wrr ip_vs_sh] or no builtin kernel ipvs support was found: map[ip_vs_wrr:{} ip_vs_sh:{} nf_conntrack_ipv4:{} ip_vs:{} ip_vs_rr:{}]. However, these modules may be loaded automatically by kube-proxy for you if they are available on your system. To verify IPVS support: Run "lsmod | grep 'ip_vs\|nf_conntrack'" and verify each of the above modules are listed. If they are not listed, you can use the following methods to load them: 1. For each missing module run 'modprobe $modulename' (e.g., 'modprobe ip_vs', 'modprobe ip_vs_rr', ...) 2. If 'modprobe $modulename' returns an error, you will need to install the missing module support for your kernel. Fixes: kubernetes/kubeadm#975 --- pkg/util/ipvs/BUILD | 1 + pkg/util/ipvs/kernelcheck_linux.go | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg/util/ipvs/BUILD b/pkg/util/ipvs/BUILD index 784a343e37..88111db03d 100644 --- a/pkg/util/ipvs/BUILD +++ b/pkg/util/ipvs/BUILD @@ -41,6 +41,7 @@ go_library( "@io_bazel_rules_go//go/platform:linux": [ "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/github.com/docker/libnetwork/ipvs:go_default_library", + "//vendor/github.com/lithammer/dedent:go_default_library", "//vendor/k8s.io/klog:go_default_library", ], "//conditions:default": [], diff --git a/pkg/util/ipvs/kernelcheck_linux.go b/pkg/util/ipvs/kernelcheck_linux.go index 286a3098c0..6389d58366 100644 --- a/pkg/util/ipvs/kernelcheck_linux.go +++ b/pkg/util/ipvs/kernelcheck_linux.go @@ -26,6 +26,7 @@ import ( "k8s.io/apimachinery/pkg/util/sets" utilsexec "k8s.io/utils/exec" + "github.com/lithammer/dedent" "k8s.io/klog" ) @@ -80,10 +81,20 @@ func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []err } } if len(builtInModules) != 0 { - warnings = append(warnings, fmt.Errorf( - "the IPVS proxier will not be used, because the following required kernel modules are not loaded: %v or no builtin kernel ipvs support: %v\n"+ - "you can solve this problem with following methods:\n 1. Run 'modprobe -- ' to load missing kernel modules;\n"+ - "2. Provide the missing builtin kernel ipvs support\n", modules, builtInModules)) + warnings = append(warnings, fmt.Errorf(dedent.Dedent(` + + The IPVS proxier may not be used because the following required kernel modules are not loaded: %v + or no builtin kernel IPVS support was found: %v. + However, these modules may be loaded automatically by kube-proxy if they are available on your system. + To verify IPVS support: + + Run "lsmod | grep 'ip_vs|nf_conntrack'" and verify each of the above modules are listed. + + If they are not listed, you can use the following methods to load them: + + 1. For each missing module run 'modprobe $modulename' (e.g., 'modprobe ip_vs', 'modprobe ip_vs_rr', ...) + 2. If 'modprobe $modulename' returns an error, you will need to install the missing module support for your kernel. + `), modules, builtInModules)) } }