Service Discovery of Containers with Host Networking

I’ve got this scenario:

  • 3 hosts
  • 2 services, Service A and Service B
  • Service A runs on every host (global) with Host Networking (no rancher managed IP)
  • Service B is linked to Service A for discovery, but the DNS doesn’t return anything

Ideally, we would like to get public ip addresses of the hosts where Service A is running while discovering it from the Service B, since Rancher could run in different datacenters with potentially overlapping private IP ranges. What could work is a managed IP (10.42.x) for the host itself, but in our case we would need to somehow map it to the public IP (which could be done through the dns bind or some other way). What’s the planned roadmap here? Thoughts?

@Kel thanks for bringing up the use case.

Today containers with Host networking don’t get registered to Rancher DNS, therefore you get empty DNS reply when try to resolve them.

Now about possible way to implement it. The idea of host networking is that we don’t do anything with networking. So we would not be assigning a 10.42 IP to the host. We could resolve that DNS entry to the IP of server, but that will be the CATTLE_AGENT_IP. From the Rancher perspective we just have that one IP, if your server has different IPs or an externally bound IP (like Amazon EIP), we wouldn’t know about it. So the IP we would resolve to might be a little limited in flexibility. Would that be good enough to support your use case?

Thanks @alena, the value of ```CATTLE_AGENT_IP```` should be fine for our use case. And generally speaking, this should be flexible enough as it can still be set for each particular host anyway.

Maybe a better solution would be to optionally set -e HOST_ACCESS_IP on rancher/agent container as well and default to CATTLE_AGENT_IP if the access IP for the host isn’t set. Just an idea, but it might be a good solution to separate the agent ip and the access ip that get registered into DNS.

@Kel filed this ticket to keep track of the feature-to-implement:

1 Like