could not invoke kubernetes service by internal endpont

8/8/2020

I want to invoke service in my kuberetes cluster, so I try to invoke servcie(the backend pod deployment by deplyment) like this:

curl http://soa-illidan-hub-service.dabai-fat.svc.cluster.local:11024

it tell me curl: (7) Failed to connect to soa-illidan-hub-service.dabai-fat.svc.cluster.local port 11024: Host is unreachable, and I am ping:

/ # ping soa-illidan-hub-service.dabai-fat.svc.cluster.local
PING soa-illidan-hub-service.dabai-fat.svc.cluster.local (10.254.42.62): 56 data bytes
64 bytes from 10.254.42.62: seq=0 ttl=64 time=0.051 ms
64 bytes from 10.254.42.62: seq=1 ttl=64 time=0.063 ms
64 bytes from 10.254.42.62: seq=2 ttl=64 time=0.057 ms

why the curl tell me host is unreachable? and. I could using endpoint ip to invoke servcie,should I using ip? using servcie ip is a good practice?

-- Dolphin
kubernetes

2 Answers

8/8/2020

Try

wget -qO- http://soa-illidan-hub-service.dabai-fat.svc.cluster.local

or try directly to pod ip

wget -qO- POD_IP:PORT
-- Dashrath Mundkar
Source: StackOverflow

8/8/2020

I finnally find the reason, the pod's running node kube-proxy stopped. Try to start kube-proxy will fix this, in my centos 7.6 start like this:

systemctl start kube-proxy
-- Dolphin
Source: StackOverflow