Merge pull request #74033 from bart0sh/PR0060-kubeadm-975-RequiredIPVSKernelModulesAvailable-warning-seems-confusing

kubeadm: fix RequiredIPVSKernelModulesAvailable warning message
pull/564/head
Kubernetes Prow Robot 2019-03-05 02:04:03 -08:00 committed by GitHub
commit 43616fc920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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))
} }
} }