mesosphere / mesos-dns

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

Mesos-DNS should not try and guess it's IP #379

Closed cmaloney closed 3 months ago

cmaloney commented 8 years ago

Running / deploying DCOS we've found that software does not have a simple / reliable way to get the "correct" IP address for the host. Trying to do a reverse lookup on the hostname doesn't work (hostnames aren't set right or there isn't a global set of reverse-DNS entries). Looking up the default network route doesn't work (the network applications on top of DCOS should talk on is set to the default network, Mesos is expected to talk on a different network), as well as a number of other scenarios.

We ship every host in DCOS with exactly the same static configuration. This makes some problems (such as upgrading), a lot easier since every host doesn't have "magic" per-host extra state, as well as making our installs a lot more reliable (All that happens on host is the extraction of a big tarball then running tested code).

It is also important to note we run all the software through systemd, and systemd does not itself interpret bash statements in Exec lines (it will do environment variable substitution, but no subcommand execution).

To allow sysadmins to configure "what IP should DCOS system software on a given host run with" we have them right an ip-detect script which when run will output the IP address the software should listen on. In AWS for instance, this will do something like ask the AWS metadata service what the local IPv4 Address is (curl -fsSL http://169.254.169.254/latest/meta-data/local-ipv4). The script always takes no arguments, and outputs one (and only one) IPv4 address to stdout. If the address is not a valid IPv4 address or more than just the IPv4 address and whitespace is output, the software calling the ip-detect script should error and exit.

Mesos-DNS needs to gain the ability to run this ip-detect script to figure out its ip. This can be through some generic mechanism (ex: If an argument begins with @exec: the given script will be executed) or only for this one particular case (Gain a ip_detect_filename argument). I generally don't like having the ability to do arbitrary code injection, but in this case it is the best option at present, so prefer something towards the latter, but am fine with either.

jdef commented 8 years ago

@sargun are we still using milestones for mesos-dns? If so should this be added to 1.0?

sargun commented 8 years ago

Just curious - which IP is given for ip_detect? If the system has multiple IPs?

cmaloney commented 8 years ago

Entirely up to the sysadmin, whatever they think is most appropriate for Mesos internal communication.

sargun commented 8 years ago

Do we recommend that people supply an IP that's routable?

cmaloney commented 8 years ago

The answer is it's the right IP to use for their datacenter. We build out a preflight check harness to ensure that it's a IP that works correctly.

jdef commented 7 years ago

504 #501