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
pull/564/head
Ed Bartosh 2019-02-13 21:56:38 +02:00
parent 07428f7e5d
commit 09a2e49a94
2 changed files with 16 additions and 4 deletions

View File

@ -41,6 +41,7 @@ go_library(
"@io_bazel_rules_go//go/platform:linux": [ "@io_bazel_rules_go//go/platform:linux": [
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/github.com/docker/libnetwork/ipvs: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", "//vendor/k8s.io/klog:go_default_library",
], ],
"//conditions:default": [], "//conditions:default": [],

View File

@ -26,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
utilsexec "k8s.io/utils/exec" utilsexec "k8s.io/utils/exec"
"github.com/lithammer/dedent"
"k8s.io/klog" "k8s.io/klog"
) )
@ -80,10 +81,20 @@ func (r RequiredIPVSKernelModulesAvailableCheck) Check() (warnings, errors []err
} }
} }
if len(builtInModules) != 0 { if len(builtInModules) != 0 {
warnings = append(warnings, fmt.Errorf( warnings = append(warnings, fmt.Errorf(dedent.Dedent(`
"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"+ The IPVS proxier may not be used because the following required kernel modules are not loaded: %v
"2. Provide the missing builtin kernel ipvs support\n", modules, builtInModules)) 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))
} }
} }