I'm trying to connect a Windows node to a Kubernetes cluster, but when running the kube-proxy in usermode I keep getting the error The requested address is not valid in its context
. How can I fix this?
![](../../users/profiles/64046.webp)
- 395
- 4
- 10
1 Answers
Answering this one myself because it was one of those little undocumeted gotchas when setting up a Windows node in a K8S cluster.
The code in netsh.go from the Kubernetes code base includes a function like this:
// GetInterfaceToAddIP returns the interface name where Service IP needs to be added
// IP Address needs to be added for netsh portproxy to redirect traffic
// Reads Environment variable INTERFACE_TO_ADD_SERVICE_IP, if it is not defined then "vEthernet (HNS Internal NIC)" is returned
func (runner *runner) GetInterfaceToAddIP() string {
if iface := os.Getenv("INTERFACE_TO_ADD_SERVICE_IP"); len(iface) > 0 {
return iface
}
return "vEthernet (HNS Internal NIC)"
}
This function says that proxied service IP addresses will be added to a NIC adapter called vEthernet (HNS Internal NIC)
unless you specify the INTERFACE_TO_ADD_SERVICE_IP
environment variable by calling netsh interface ipv4 add address name="vEthernet (HNS Internal NIC)" address=10.100.0.10
. If vEthernet (HNS Internal NIC)
doesn't exist (and it won't unless you have set it up yourself) then you get the The requested address is not valid in its context
error.
Following the docs at https://docs.microsoft.com/en-us/virtualization/windowscontainers/kubernetes/getting-started-kubernetes-windows#preparing-a-windows-node results in a NIC called vEthernet (cbr0)
, which can be used in the INTERFACE_TO_ADD_SERVICE_IP
environment variable.
![](../../users/profiles/64046.webp)
- 395
- 4
- 10