Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking first interface address in hostgw instead of the last one - required for kube-proxy in userspace #8

Open
wants to merge 6 commits into
base: windowsHostGw180115
Choose a base branch
from

Conversation

ptylenda
Copy link

@ptylenda ptylenda commented Mar 4, 2018

NOTE: this pull request is for your gonetsh vendor package - I am not sure how currently the packages should be maintained, treat this pull request more like a "issue report and workaround"

When kubeproxy is running in userspace mode, it will attach multiple interfaces for services to cbr0 interface like below:

Configuration for interface "vEthernet (nat)"
    DHCP enabled:                         Yes
    IP Address:                           172.17.32.1
    Subnet Prefix:                        172.17.32.0/20 (mask 255.255.240.0)
    InterfaceMetric:                      15

Configuration for interface "vEthernet (Ethernet)"
    DHCP enabled:                         Yes
    IP Address:                           172.28.1.208
    Subnet Prefix:                        172.28.1.0/23 (mask 255.255.254.0)
    Default Gateway:                      172.28.1.1
    Gateway Metric:                       0
    InterfaceMetric:                      25

Configuration for interface "vEthernet (cbr0_ep)"
    DHCP enabled:                         No
    IP Address:                           10.200.9.2
    Subnet Prefix:                        10.200.9.0/24 (mask 255.255.255.0)
    IP Address:                           10.201.0.1
    Subnet Prefix:                        10.0.0.0/8 (mask 255.0.0.0)
    IP Address:                           10.201.0.10
    Subnet Prefix:                        10.0.0.0/8 (mask 255.0.0.0)
    IP Address:                           10.201.39.237
    Subnet Prefix:                        10.0.0.0/8 (mask 255.0.0.0)
    Default Gateway:                      10.200.9.1
    Gateway Metric:                       256
    InterfaceMetric:                      25

Configuration for interface "Loopback Pseudo-Interface 1"
    DHCP enabled:                         No
    IP Address:                           127.0.0.1
    Subnet Prefix:                        127.0.0.0/8 (mask 255.0.0.0)
    InterfaceMetric:                      75

Current implementation of flannel hostgw backed for windows will result then in:

I0304 03:10:55.183836   10116 hostgw_windows.go:197] Attached bridge endpoint [cbr0_ep] to host
I0304 03:10:55.411837   10116 hostgw_windows.go:211] Enabled forwarding on [vEthernet (Ethernet)] index [7]
E0304 03:10:55.543839   10116 main.go:285] Error registering network: unable to find interface for IP Addess [10.200.9.2], error: Interface not found: 10.200.9.2
I0304 03:10:55.544849   10116 main.go:338] Stopping shutdownHandler...

This is caused by the fact, that the last IP ("10.201.39.237") for cbr0 will be taken as main interface IP instead of "10.200.9.2".

The pull request fixes this issue by not overwriting IP, subnet and gateway if they are already resolved, there is a probably better way to do this using pure netsh commands, but I am not an expert in this manner.

@madhanrm madhanrm force-pushed the windowsHostGw180115 branch from 9944210 to f8f5fc8 Compare March 7, 2018 00:26
@rakelkar
Copy link
Owner

rakelkar commented Mar 7, 2018

@Dingov @madhanrm FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants