I am trying to set up MongoDB and MongoDB monitoring agent on a kubernetes cluster.
The monitoring agent first queries the service endpoint for the mongodb instance, and receives the hostname as a response. It then stops using the service endpoint, and starts to use the hostname to connect to the instance which fails as there is no resolution to get the container name resolved.
I think I can use a headless service to achieve this, although using headless service is not an option.
Is there any way to enable hostname resolution for containers/pods in Kubernetes or inject custom DNS records in kube-dns?