-1

I cannot access a pod from another pod with its service name. Getting error as

cannot resolve host svcname

When i try to view the information of /etc/resolv.conf, i do see ec2.internal as searches and ndots as 1. What does this means and how do i solve this to access a pod from another pod with the service name.

1
  • 1
    can you show us the URL format you trying to reach? are you using .local? – Saikat Chakrabortty Jan 1 at 12:39
0

Your /etc/resolve.conf should include search <currentnamespace>.svc.cluster.local svc.cluster.local cluster.local to discover hostnames that aren't FQDN.

As an example, this is the content of my pod's /etc/resolve.conf:

nameserver 10.100.0.10
search staging.svc.cluster.local svc.cluster.local cluster.local eu-west-1.compute.internal

With this configuration, DNS resolution works like this:

  1. Is the hostname a fully qualified domain name (FQDN)? (In other words, does it end with a dot, like "google.com.")
  2. If it's an FQDN, query nameserver (10.100.0.10) for the hostname.
  3. If it's not an FQDN, then append the 1st element of the config search to the hostname. svcname -> svcname.staging.svc.cluster.local and query the nameserver.
  4. If no results found, try to append the 2nd element of the config search to the hostname and query the nameserver.
  5. ...

You want to resolve the hostname svcname but its FQDN is svcname.<namespace>.svc.cluster.local. and you need that search configuration to convert it to FQDN.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.