我已经创建了一个示例node.js应用程序和其他必需文件(deployment.yml、service.yml),但我无法访问该服务的外部IP。
#kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.7.240.1 <none> 443/TCP 23h
node-api LoadBalancer 10.7.254.32 35.193.227.250 8000:30164/TCP 4m37s
#kubectl get pods
NAME READY STATUS RESTARTS AGE
node-api-6b9c8b4479-nclgl 1/1 Running 0 5m55s
#kubectl describe svc node-api
Name: node-api
Namespace: default
Labels: <none>
Annotations: <none>
Selector: app=node-api
Type: LoadBalancer
IP: 10.7.254.32
LoadBalancer Ingress: 35.193.227.250
Port: <unset> 8000/TCP
TargetPort: 8000/TCP
NodePort: <unset> 30164/TCP
Endpoints: 10.4.0.12:8000
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal EnsuringLoadBalancer 6m19s service-controller Ensuring load balancer
Normal EnsuredLoadBalancer 5m25s service-controller Ensured load balancer当我试图在外部ip上做卷曲时,它会拒绝连接。
curl 35.193.227.250:8000
curl: (7) Failed to connect to 35.193.227.250 port 8000: Connection refused我也在Dockerfile中公开了端口8000。如果我遗漏了什么就告诉我。
发布于 2018-12-06 16:43:52
看看你在这条线上的描述,似乎一切都很好。以下是您可以尝试的:
在完成SSH之后,尝试对集群和Service进行压缩,以查看您是否得到响应。
之后,运行本地主机,查看是否得到响应。
$ curl localhost因此,如果您在尝试上述故障排除步骤时得到响应,那么这可能是GKE中的一个底层问题。您可以提交一个缺陷报告这里。
如果在尝试上述步骤时没有得到任何响应,则有可能在某个地方配置了群集。
在我看来,这似乎是解决用例故障的一个很好的起点。
https://stackoverflow.com/questions/52681326
复制相似问题