Kubernetes NodePort connection timed out

7/28/2019

I started the kubernetes cluster using kubeadm on two servers rented from DigitalOcean. I use Flannel as CNI. After launching the cluster, I, following this tutorial, created deployment and service.

$ 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>

Trying to access to pods from master node(server1)

$ 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

Trying to access to pods from worker node(server2)

$ 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!
-- Andrey
kubernetes
weave

0 Answers