Report this

What is the reason for this report?

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

Posted on April 28, 2020

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!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

This comment has been deleted

Hello,

You can make sure that the domain name’s DNS is pointed correctly. All DNS changes might take up to 24 hours in order to fully resolve. This happens because of DNS cache and general DNS propagation time.

Also, make sure the namespace is correct when resolving the service. If your service is in a different namespace than the default, you’ll need to use the full FQDN.

Regards

Hello,

You can make sure that the domain name’s DNS is pointed correctly. All DNS changes might take up to 24 hours in order to fully resolve. This happens because of DNS cache and general DNS propagation time.

Also, make sure the namespace is correct when resolving the service. If your service is in a different namespace than the default, you’ll need to use the full FQDN.

Regards

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.