mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #46678 from tacy/fix46039
Automatic merge from submit-queue fix#46039: iptables proxier need use '--bind-address' if set **What this PR does / why we need it**: iptables proxier need use '--bind-address' if set **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #46039 **Special notes for your reviewer**: **Release note**: ```release-note ```
This commit is contained in:
commit
117b6248ef
@ -472,6 +472,12 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
|
|||||||
proxyMode := getProxyMode(string(config.Mode), iptInterface, iptables.LinuxKernelCompatTester{})
|
proxyMode := getProxyMode(string(config.Mode), iptInterface, iptables.LinuxKernelCompatTester{})
|
||||||
if proxyMode == proxyModeIPTables {
|
if proxyMode == proxyModeIPTables {
|
||||||
glog.V(0).Info("Using iptables Proxier.")
|
glog.V(0).Info("Using iptables Proxier.")
|
||||||
|
var nodeIP net.IP
|
||||||
|
if config.BindAddress != "0.0.0.0" {
|
||||||
|
nodeIP = net.ParseIP(config.BindAddress)
|
||||||
|
} else {
|
||||||
|
nodeIP = getNodeIP(client, hostname)
|
||||||
|
}
|
||||||
if config.IPTables.MasqueradeBit == nil {
|
if config.IPTables.MasqueradeBit == nil {
|
||||||
// MasqueradeBit must be specified or defaulted.
|
// MasqueradeBit must be specified or defaulted.
|
||||||
return nil, fmt.Errorf("unable to read IPTables MasqueradeBit from config")
|
return nil, fmt.Errorf("unable to read IPTables MasqueradeBit from config")
|
||||||
@ -488,7 +494,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
|
|||||||
int(*config.IPTables.MasqueradeBit),
|
int(*config.IPTables.MasqueradeBit),
|
||||||
config.ClusterCIDR,
|
config.ClusterCIDR,
|
||||||
hostname,
|
hostname,
|
||||||
getNodeIP(client, hostname),
|
nodeIP,
|
||||||
recorder,
|
recorder,
|
||||||
healthzServer,
|
healthzServer,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user