YoungDo Park
YoungDo Park

Reputation: 21

kubernetes Nodeport service : can't access with cluster ip

1 Master : 10.166.232.164 2 Worker : 10.166.232.165, 10.166.232.166

Deploy 3 replica pods for 2 worker nodes

Nodeport service

problem is i can access by curl podIP:8080

but

exec pod and access by clusterIP:Nodeport is not working

kubectl exec -it network-example2-84c98c7b4d-d7wnr /bin/bash -- curl 10.98.10.159:8080 => curl: (7) Failed to connect to 10.98.10.159 port 8080: Connection refused

kubectl exec -it network-example2-84c98c7b4d-d7wnr /bin/bash -- curl 10.98.10.159:23060 => no answer(maybe timeout error)

is it firewall problem..? or CNI..?

I'm using weave-net and no change any config

Upvotes: 0

Views: 1927

Answers (1)

gohm'c
gohm'c

Reputation: 15548

A closer look to your screenshot indicate you have set externalTrafficPolicy to Local. Try:

curl 10.166.232.165:32060 or curl 10.166.232.166:32060

"Local" means only the node which has the pod running will response to you, otherwise your request will be drop. Change to "Cluster" if you wish all the nodes will response to you regardless if it has the pod running.

Upvotes: 1

Related Questions