我已经创建了一个带有多节点池的K8s集群,因为我需要使用windows容器。windows节点池有1个节点。我已经创建了部署和类型为Load Balancer的服务,该服务在部署时获得了外部IP。但当我从笔记本电脑ping外部IP时,我收到一个超时的请求。我有一些WCF微服务需要访问部署在windows容器中的服务,反之亦然。由于我无法从我的机器上ping负载均衡器IP,我怀疑WCF微服务也会。我无法从运行这些外部微服务的Azure VM ping此外部IP。我们可以从互联网上ping分配给K8s负载均衡器的外部IP吗。如果是,我是否需要对集群或Vnet/子网进行额外的配置更改?
我还创建了一个公共静态IP,并将其分配给服务yaml。这个静态IP我也作为环境变量传入了部署文件,这样其他WCF微服务就知道了它们需要通信的IP地址。
PS Azure:> kubectl get service myservice --watch
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
myservice LoadBalancer 10.0.0.50 20.185.104.254 9163:30733/TCP,23010:30526/TCP 2d8h
PS Azure:> kubectl describe service myservice
Name: myservice
Namespace: default
Labels: app=myservice
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"myservice"},"name":"myservice","namespac...
Selector: app=myservice
Type: LoadBalancer
IP: 10.0.0.50
LoadBalancer Ingress: 20.185.104.254
Port: svcproxy 9163/TCP
TargetPort: 9163/TCP
NodePort: svcproxy 30733/TCP
Endpoints: <none>
Port: banyan 23010/TCP
TargetPort: 23010/TCP
NodePort: banyan 30526/TCP
Endpoints: <none>
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
Azure:/
预期-应该能够ping外部IP。
实际-无法做到100%数据包丢失
C:windowssystem32>ping 20.185.104.254
Pinging 20.185.104.254 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 20.185.104.254:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss)
检查入站防火墙规则。很可能您已经阻止了入站流量。