Define custom nameserver in /etc/resolv.conf of the Pods

Rancher versions:
rancher/server or rancher/rancher: v2.1.5
rancher/agent or rancher/rancher-agent: v2.1.5

Here is my requirment:

  • The containers should be able to resolve each other using their hostnames defined in the Workload - Working fine
  • DNS queries should resolve external services like google.com - Working fine
  • DNS queries should also be resolved using the DNS server defined in /etc/resolv.conf of the host. (AWS private hosted zone) - NOT Working

I’m using ClusterFirst dnsPolicy with no Host’s Network Namespace.

The /etc/resolv.conf in the Pod has only KubeDNS IP.

I tried to define the following in the Workload but, doesn’t seem to work
dnsConfig:
nameservers:
- 10.0.0.2
searches:
- mycompany.local

Any other way I can achieve all my requirements?

Thank you!