'How does container communicates with kubernetes nameserver

I have a pod named 'test' deployed in default namespace which is having a container named 'sample' in test pod. Container's /etc/resolve.conf has kubernetes nameserver IP. I have private interface, public interface and default gateway configured inside container. Via public interface I was able to reach kubernetes nameserver from container and get domains resolved but with private interface I got an error saying "no server could be reached". But by default, container is trying to reach the nameserver via private interface.

  1. Normally, container to nameserver communication happen via private or public interface? Does coredns can only be reachable via public interface?

  2. How can I solve this issue to reach kubernetes nameserver from my container?

It would be really grateful if someone answers my above questions. Thanks in advance!!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source