My database is running in different host which is not deployed in kubernetes( for eg: hostName is testDevDb)
When i run my Micro Service(MS) as K8 Pod, MS cannot able to open connection with external database. i am getting unknown host exception. Looks like DNS is not resolved.
Caused by: java.net.UnknownHostException: testDevDb
at java.net.InetAddress$CachedAddresses.get(InetAddress.java:797) ~[?:?]
at java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[?:?]
at java.net.InetAddress.getAllByName(InetAddress.java:1364) ~[?:?]
at java.net.InetAddress.getAllByName(InetAddress.java:1298) ~[?:?]
I don't find right article to resolve this.
Is there any way to use of host's /etc/resolv.conf inside K8's POD.
Please help me the right approach to resolve this
If you want to add host and IP information to
/etc/hostsfile inside a pod, you can usehostAliases. There is an example for a pod in doc.sample deployment.yaml: