If you have gone through deploying your applications on Kubernetes, you will realize how Kubernetes relies heavily on DNS and you may notice that Kubernetes has a local DNS service that takes care of DNS related activities.
This DNS service is used by Kubernetes master nodes to locate worker nodes, and for sure if your contains needs to communicate with the external world, also containers connect to each other through services which register their names in that DNS service.
Older versions of Kubernetes were using kube-dns and the latest versions have switched tp coreDNS for DNS resolutions.
Micro Focus deployment of its suites, you will notice Core-DNS is appearing starting from version 2019.02.
Micro Focus is recommending to add your hosts in a file and load it during the installation of CDF using KUBE_DNS_HOSTS in the install.properties
In the article, I will show you in a few steps to add a fixed host-to-IP as this is needed especially with integration with servers that are not resolvable by your local DNS servers.
Note: It is strongly recommended to fix your DNS issues and use this tip as last resort.
1- prepare your host to IP list same as hosts file format
2- edit coredns configmpa
kubectl edit -n kube-system cm coredns
3- Add your list under hosts section, ensure it is at the same indent level as fallthrough
4- You may Save and Quit depend on your editor
5- delete your codedns pods; it will be automatically recreated.
kubectl delete -n kube-system pod <coredns pod 1> <coredns pod 2> <coredns pod 3>
Now you can check your name resolution through your application, also you can use this command to deploy DNS testing container from Infoblox.
kubectl run -it –rm –restart=Never –image=infoblox/dnstools:latest dnstools
Note: If your Kubernetes cluster is not connected to the internet, the test container will fail.
Please let me know your feedback on this tip and let me know if you like it or not, comment on what types of tips you may be interested in!