d2iq-archive / mesos-dns

DNS-based service discovery for Mesos.
https://mesosphere.github.com/mesos-dns
Apache License 2.0
483 stars 137 forks source link

Returns docker container IP instead of mesos host one #477

Open eLvErDe opened 8 years ago

eLvErDe commented 8 years ago

Hello,

I have a docker container running RMQ, in Marathon. One port is tagged as amqp (data protocol), the other one as mgmt (management interface)

Where doing:

dig -t SRV _amqp._rabbitmq-sentinelpoller-geojson.sentinel.data-pollers._tcp.marathon.mesos

I received the following answer:

;; ANSWER SECTION:
_amqp._rabbitmq-sentinelpoller-geojson.sentinel.data-pollers._tcp.marathon.mesos. 30 IN SRV 0 0 31673 rabbitmq-sentinelpoller-geojson.sentinel.data-pollers-ywmud-s8.marathon.mesos.

;; ADDITIONAL SECTION:
rabbitmq-sentinelpoller-geojson.sentinel.data-pollers-ywmud-s8.marathon.mesos. 30 IN A 172.17.0.2

I do not expect to receive 172.17.0.2 as address which is the internal NON-ROUTED docker address. Actually marathon also display a link to both data and mgmt port and use the right mesos host address.

Did I do something wrong ?

Best regards, Adam.

eLvErDe commented 8 years ago

Hello,

Okay, it seems to be related to IPSources setting:

https://mesosphere.github.io/mesos-dns/docs/configuration-parameters.html

IPSources defines a fallback list of IP sources for task records, sorted by priority. If you use Docker, and enable the netinfo IPSource, it may cause tasks to become unreachable, because after Mesos 0.25, the Docker executor publishes the container's internal IP in NetworkInfo.

The default value is: ["netinfo", "mesos", "host"]

Switching to host first fix it. Would you consider changing the default setting ? I don't really see the point returning the docker private address, it's completly pointless as mesos uses docker-proxy to bind the port on the host itself.

jdef commented 7 years ago

We've considered changing the default setting but have avoided doing so because (a) it breaks behavior that long-time users expect (and have scripted for in production); (b) it's easy enough to configure what you really want, and; (c) it's extremely difficult to arrive at a default that satisfies nearly everyone OOTB because clusters come in many flavors.

We've tried to do a good job documenting this behavior. It's arguable that we could do better. What would have helped you troubleshoot this more quickly?

xkrt commented 6 years ago

@jdef looks like official documentation are outdated http://mesosphere.github.io/mesos-dns/docs/configuration-parameters.html, it doesn't contain IPSources field.