Question

Pod trying to curl a service : "Could not resolve host"

Posted April 28, 2020 864 views
Kubernetes

Hey, I’ve tried getting information about DNS discovery.
I thought maybe I need to configure this, but by the docs, it seems this is supposed to be built-in.

In my pod, I tried to curl against the load balancer I created for him.
When I curl against the cluster IP & Internal IP of the service - it’s working.
but when I try to use the service name (eg: curl http://ranks-service:80/rank)
I get the error: “curl: (6) Could not resolve host: ranks-service”
I checked /etc/hosts:

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
10.244.0.76 ranks-864cf4c995-gk5g5

I would really appreciate having some help with this, Thanks!

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer