I have setup a Kubernetes Windows Node. I set up the cluster network using flannel by following this documentation.
I can start pods on the windows node and I can also connect to the Windows node from the Linux master by using kubectl exec
. I am running the simpleweb webserver on the windows node. From a powershell inside the container I can also confirm that the webserver is running. So from all I can tell, basic connectivity is up and scheduling pods on the Windows node works.
However, I am unable to connect to the pod IP and port. I can neither connect from the Windows host nor from the Linux master.
My Windows Host IP is 172.33.1.150. The Pod on the Windows node is in the subnet 10.244.2.0/24 with IP 10.244.2.33. The cluster network that flannel sets up is the default 10.244.0.0/16.
Based on my current understanding the pod gets an IP in the cluster network (e.g. 10.244.2.33). Shouldn't I be able to access that IP and port 80 from the windows host?
I noticed, that the windows node has no network interface with a cluster IP, while my Linux node does have a network interface with a cluster IP (e.g. 10.244.1.1).
Update: Using the Get-HnsEndpoint
powershell command I can actually see that there exists an HNS interface for the network 10.244.1.0/24
on my windows node.
Update 2: I discovered the following line in the logs of the my flannel containers:
ignoring non-vxlan subnet(10.244.2.0/24): type=host-gw
Update 3:
kubectl describe pod win-webserver-123456789a-abcde
:
Name: win-webserver-123456789a-abcde
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: ec2amaz-1234567/172.33.1.150
Start Time: Thu, 18 Oct 2018 13:06:11 +0000
Labels: app=win-webserver
pod-template-hash=123456789a
Annotations: <none>
Status: Running
IP: 10.244.2.83
Controlled By: ReplicaSet/win-webserver-123456789a
Containers:
windowswebserver:
Container ID: docker://17b6415b05bc73443cbfc848bfd85015d03aa8448ee054232604348908cc0451
Image: microsoft/windowsservercore:1803
Image ID: docker-pullable://microsoft/windowsservercore@sha256:1095736efb6d27ca9a5c9df3ff399cab8130a2915f84c3a0b253480532878ecb
Port: <none>
Host Port: <none>
Command:
powershell.exe
-command
<#code used from https://gist.github.com/wagnerandrade/5424431#> ; $$listener = New-Object System.Net.HttpListener ; $$listener.Prefixes.Add('http://*:80/') ; $$listener.Start() ; $$callerCounts = @{} ; Write-Host('Listening at http://*:80/') ; while ($$listener.IsListening) { ;$$context = $$listener.GetContext() ;$$requestUrl = $$context.Request.Url ;$$clientIP = $$context.Request.RemoteEndPoint.Address ;$$response = $$context.Response ;Write-Host '' ;Write-Host('> {0}' -f $$requestUrl) ; ;$$count = 1 ;$$k=$$callerCounts.Get_Item($$clientIP) ;if ($$k -ne $$null) { $$count += $$k } ;$$callerCounts.Set_Item($$clientIP, $$count) ;$$ip=(Get-NetAdapter | Get-NetIpAddress); $$header='<html><body><H1>Windows Container Web Server</H1>' ;$$callerCountsString='' ;$$callerCounts.Keys | % { $$callerCountsString+='<p>IP {0} callerCount {1} ' -f $$ip[1].IPAddress,$$callerCounts.Item($$_) } ;$$footer='</body></html>' ;$$content='{0}{1}{2}' -f $$header,$$callerCountsString,$$footer ;Write-Output $$content ;$$buffer = [System.Text.Encoding]::UTF8.GetBytes($$content) ;$$response.ContentLength64 = $$buffer.Length ;$$response.OutputStream.Write($$buffer, 0, $$buffer.Length) ;$$response.Close() ;$$responseStatus = $$response.StatusCode ;Write-Host('< {0}' -f $$responseStatus) } ;
State: Running
Started: Thu, 18 Oct 2018 13:06:18 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-4l7tt (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-4l7tt:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-4l7tt
Optional: false
QoS Class: BestEffort
Node-Selectors: beta.kubernetes.io/os=windows
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events: <none>
ipconfig
:
Windows IP Configuration
Ethernet adapter vEthernet (Ethernet 3):
Connection-specific DNS Suffix . : eu-central-1.compute.internal
Link-local IPv6 Address . . . . . : [...]
IPv4 Address. . . . . . . . . . . : 172.33.1.150
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 172.33.1.1
Ethernet adapter vEthernet (nat):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : [...]
IPv4 Address. . . . . . . . . . . : 172.29.160.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
Get-HnsEndpoint
(brief):
IPAddress : 10.244.1.16
IsRemoteEndpoint : True
State : 1
Type : l2bridge
VirtualNetworkName : cbr0
DNSServerList : 10.244.1.2
GatewayAddress : 10.244.0.2
IPAddress : 10.244.2.82
PrefixLength : 24
State : 1
Type : l2bridge
VirtualNetworkName : cbr0
IPAddress : 10.244.1.17
IsRemoteEndpoint : True
State : 1
Type : l2bridge
VirtualNetworkName : cbr0
IPAddress : 172.33.1.142
IsRemoteEndpoint : True
State : 1
Type : l2bridge
VirtualNetworkName : cbr0
DNSServerList : 10.244.1.2
GatewayAddress : 10.244.0.2
IPAddress : 10.244.2.84
PrefixLength : 24
State : 3
Type : l2bridge
VirtualNetworkName : cbr0
DNSServerList : 10.244.1.2
GatewayAddress : 10.244.0.2
IPAddress : 10.244.2.83
PrefixLength : 24
State : 3
Type : l2bridge
VirtualNetworkName : cbr0