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

Custom top level domains with mesos-dns in DC/OS? #487

Closed richardgirges closed 7 years ago

richardgirges commented 7 years ago

What we're trying to do

We're trying to setup mesos-dns inside of our DC/OS cluster to setup a custom top-level domain for our DC/OS services.

For instance, this service in our DC/OS cluster: foo.marathon.mesos:8080

Should be accessible to non-DC/OS services like so: foo.marathon.mesos.steelhouse.com:8080

This document actually got us all the way there: https://docs.mesosphere.com/1.8/usage/service-discovery/mesos-dns/custom-domain-service-discovery/

mesos-dns-ext config file

{
  "domain": "mesos.steelhouse.com",
  "externalon": false,
  "listener": "0.0.0.0",
  "masters": ["10.61.118.43:5050"],
  "port": 53,
  "recurseon": false,
  "refreshSeconds": 60,
  "resolvers": ["8.8.8.8","8.8.4.4"],
  "SOAExpire": 86400,
  "SOAMinttl": 60,
  "SOAMname": "ns1.mesos.steelhouse.com",
  "SOARefresh": 60,
  "SOARetry": 600,
  "SOARname": "root.ns1.mesos.steelhouse.com",
  "ttl": 60,
  "zk": "zk://10.61.118.43:2181/mesos"
}

mesos-dns-ext service definition file

{
  "id": "/mesos-dns-ext",
  "cmd": "/opt/mesos-dns-ext/mesos-dns --config=/opt/mesos-dns-ext/config.json",
  "instances": 1,
  "cpus": 1,
  "mem": 1024,
  "disk": 0,
  "executor": "",
  "constraints": [
    [
      "hostname",
      "CLUSTER",
      "10.61.42.81"
    ]
  ],
  "uris": [],
  "storeUrls": [],
  "ports": [
    53,
    8123
  ]
}

Zone file entries on our DNS provider, Dynect

ns1.mesos.steelhouse.com.    A    10.61.42.81
mesos.steelhouse.com.    NS   ns1.mesos.steelhouse.com

The problem

Due to dcos-spartan.service running on each DC/OS agent node, the mesos-dns-ext service fails to start; mesos-dns-ext can't bind to TCP port 53 since dcos-spartan.service is using port 53.

Are there any other solutions to getting external DNS names working for DC/OS that I may be missing?

alberts commented 7 years ago

@richardgirges since this pertains to using Spartan + Mesos-DNS + DC/OS, let's discuss at dcosjira.atlassian.net, or maybe even better to start: users@dcos.io / https://dcos.io/community/

alberts commented 7 years ago

@richardgirges while I'm here, Spartan only binds to its special IPs on agent nodes in 1.8.7. If you bind to a specific internal/external IP in "listener", you should be able to get this going.

alberts commented 7 years ago

Let us know if this works for you. If not, happy to continue the discussion as described above.

richardgirges commented 7 years ago

@alberts apologies for the late response. Your solution worked, all I had to do was bind to the internal IP in "listener" and everything was all good from there. Thanks!