/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
search staging.svc.cluster.local svc.cluster.local cluster.local eu-west-1.compute.internal
With this configuration, DNS resolution works like this:
- Is the hostname a fully qualified domain name (FQDN)? (In other words, does it end with a dot, like "google.com.")
- If it's an FQDN, query nameserver (
10.100.0.10) for the hostname.
- If it's not an FQDN, then append the 1st element of the config search to the hostname.
svcname.staging.svc.cluster.local and query the nameserver.
- If no results found, try to append the 2nd element of the config search to the hostname and query the nameserver.
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.