From b46fbbc4e692e75d46bd0b2b74cca2a818cac47f Mon Sep 17 00:00:00 2001 From: "Rostislav M. Georgiev" Date: Fri, 16 Nov 2018 12:38:16 +0200 Subject: [PATCH] kubeadm: Warn on API server bind address override ChooseAPIServerBindAddress is silently overriding the requested bind IP address for the API server if that address is deemed unsuitable. This is currently done only if the IP is a loopback one (127.0.0.0/8; ::1/128). It's best to at least issue a warning if such override occurs, so that there are no surprised users by this. Signed-off-by: Rostislav M. Georgiev --- cmd/kubeadm/app/util/config/common.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/kubeadm/app/util/config/common.go b/cmd/kubeadm/app/util/config/common.go index adbe56424e..660210706a 100644 --- a/cmd/kubeadm/app/util/config/common.go +++ b/cmd/kubeadm/app/util/config/common.go @@ -19,6 +19,7 @@ package config import ( "io/ioutil" "net" + "reflect" "strings" "github.com/pkg/errors" @@ -175,5 +176,8 @@ func ChooseAPIServerBindAddress(bindAddress net.IP) (net.IP, error) { } return nil, err } + if bindAddress != nil && !bindAddress.IsUnspecified() && !reflect.DeepEqual(ip, bindAddress) { + klog.Warningf("WARNING: overriding requested API server bind address: requested %q, actual %q", bindAddress, ip) + } return ip, nil }