我已经设置了一个Kubernetes Windows节点。我遵循Collator
,使用法兰绒设置了群集网络。
我可以在Windows节点上启动Pod,也可以使用kubectl exec
从Linux主服务器连接到Windows节点。我正在Windows节点上运行this documentation网络服务器。从容器内部的Powershell中,我还可以确认Web服务器正在运行。因此,据我所知,基本连接已建立,并且在Windows节点上调度pod可以正常工作。
但是,我无法连接到Pod IP和端口。我既无法从Windows主机也无法从Linux主服务器进行连接。
我的Windows主机IP是172.33.1.150。 Windows节点上的Pod位于IP地址为10.244.2.33的子网10.244.2.0/24中。法兰绒设置的群集网络是默认的10.244.0.0/16。
根据我目前的理解,广告连播在群集网络中获得了IP(例如10.244.2.33)。我不能从Windows主机访问该IP和端口80吗?
我注意到Windows节点没有与群集IP的网络接口,而我的Linux节点却具有与群集IP(例如10.244.1.1)的网络接口。
更新:
使用Get-HnsEndpoint
powershell命令,我实际上可以看到Windows节点上的网络10.244.1.0/24
存在一个HNS接口。
更新2: 我在法兰绒容器的日志中发现了以下行:
忽略非vxlan子网(10.244.2.0/24):type = host-gw
更新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
(简介):
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