From 7c4c1324f9ed99f32c9e8c59fef01b0a5b181695 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Steenis Date: Fri, 20 Sep 2019 14:40:53 +0200 Subject: [PATCH] Provide IP for kube-proxy if cloudprovider is set If cloudprovider is set (not empty), set the bind address because the node will not be able to retrieve it's IP address because the nodename could be set by the cloud provider (e.g. AWS and Openstack) --- cluster/plan.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cluster/plan.go b/cluster/plan.go index f122962a..a06f03ae 100644 --- a/cluster/plan.go +++ b/cluster/plan.go @@ -585,6 +585,14 @@ func (c *Cluster) BuildKubeProxyProcess(host *hosts.Host, prefixPath string, svc CommandArgs[k] = v } } + // If cloudprovider is set (not empty), set the bind address because the node will not be able to retrieve it's IP address in case cloud provider changes the node object name (i.e. AWS and Openstack) + if c.CloudProvider.Name != "" { + if host.InternalAddress != "" && host.Address != host.InternalAddress { + CommandArgs["bind-address"] = host.InternalAddress + } else { + CommandArgs["bind-address"] = host.Address + } + } // Best security practice is to listen on localhost, but DinD uses private container network instead of Host. if c.DinD {