Kubernetes NodePort连接超时

时间:2019-07-28 12:11:46

标签: kubernetes weave

我在从DigitalOcean租用的两台服务器上使用kubeadm启动了kubernetes集群。我使用Flannel作为CNI。启动集群后,我按照this教程创建了部署和服务。

$ kubectl describe svc example-service
Name:                     example-service
Namespace:                default
Labels:                   <none>
Annotations:              <none>
Selector:                 run=load-balancer-example
Type:                     NodePort
IP:                       10.99.217.181
Port:                     <unset>  8080/TCP
TargetPort:               8080/TCP
NodePort:                 <unset>  31570/TCP
Endpoints:                10.244.1.2:8080,10.244.1.3:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

尝试从主节点(server1)访问pod

$ curl 10.244.1.2:8080
curl: (7) Failed to connect to 10.244.1.2 port 8080: Connection timed out
$ curl 10.244.1.3:8080
curl: (7) Failed to connect to 10.244.1.3 port 8080: Connection timed out
$ curl curl 10.99.217.181:8080
curl: (7) Failed to connect to 10.99.217.181 port 8080: Connection timed out
$ curl [server1-ip]:31570
curl: (7) Failed to connect to [server1-ip] port 31570: Connection timed out
$ curl [server2-ip]:31570
curl: (7) Failed to connect to [server2-ip] port 31570: Connection timed out

尝试从辅助节点(server2)访问pod

$ curl 10.244.1.2:8080
Hello Kubernetes!
$ curl 10.244.1.3:8080
Hello Kubernetes!
$ curl curl 10.99.217.181:8080
Hello Kubernetes!
$ curl [server1-ip]:31570
curl: (7) Failed to connect to [server1-ip] port 31570: Connection timed out
$ curl [server2-ip]:31570
Hello Kubernetes!

0 个答案:

没有答案