Skip to content

Commit c9b91fa

Browse files
committed
proxy: honor BindAddress for the iptables proxy
A loose port of kubernetes/kubernetes#46678 If the configuration specifies a BindAddress, we should probably honor it. If the configuration doesn't, and there is no default route with which to autodetect the node address, then the user really needs to tell the proxy what address to use via BindAddress. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1462428
1 parent 7461c10 commit c9b91fa

File tree

1 file changed

+4
-1
lines changed
  • pkg/cmd/server/kubernetes/node

1 file changed

+4
-1
lines changed

pkg/cmd/server/kubernetes/node/node.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,9 @@ func (c *NodeConfig) RunProxy() {
362362
switch c.ProxyConfig.Mode {
363363
case componentconfig.ProxyModeIPTables:
364364
glog.V(0).Info("Using iptables Proxier.")
365+
if bindAddr.Equal(net.IPv4zero) {
366+
bindAddr = getNodeIP(c.Client, hostname)
367+
}
365368
if c.ProxyConfig.IPTablesMasqueradeBit == nil {
366369
// IPTablesMasqueradeBit must be specified or defaulted.
367370
glog.Fatalf("Unable to read IPTablesMasqueradeBit from config")
@@ -376,7 +379,7 @@ func (c *NodeConfig) RunProxy() {
376379
int(*c.ProxyConfig.IPTablesMasqueradeBit),
377380
c.ProxyConfig.ClusterCIDR,
378381
hostname,
379-
getNodeIP(c.Client, hostname),
382+
bindAddr,
380383
recorder,
381384
)
382385
if err != nil {

0 commit comments

Comments
 (0)