Mesos -> NS1 connector
This simple, experimental connector enables DNS based service discovery for Apache Mesos clusters via the NS1 platform. NS1 is a modern DNS and traffic management platform with delivery via a global Managed DNS network or on-prem/cloud Dedicated DNS deployments, and is suitable for performance sensitive, mission critical use cases.
This connector is inspired by the Mesos-DNS project and follows a similar approach, polling the Mesos master for cluster state, generating a set of DNS records based on the state, and (unlike Mesos-DNS, which acts as a simple nameserver itself), pushing the DNS records to the NS1 platform. NS1 propagates new and updated records to Managed and Dedicated DNS deployments in milliseconds, after which the latest Mesos state is represented for discovery via your domains serviced by NS1.
The set of records generated by the connector is identical to those generated by Mesos-DNS.
The connector is not a server -- it is a simple command line tool suitable to be run regularly, e.g. as a cron job.
Tested on Python 2.7.x with Mesos 0.28.0
Requires zbase32, requests, argparse, and the NS1 Python module
You must first create an (empty) zone in your NS1 account for your
Mesos cluster, e.g.
similar. All service discovery records will be created within the
You must also create an NS1 API Key. It is recommended to grant the minimum necessary permissions to the API Key.
Run the connector like:
./mesos2ns1.py -m <list of mesos masters> -k <NS1 key> -z <zone name>
./mesos2ns1.py -m 18.104.22.168:5050,22.214.171.124:5050,126.96.36.199:5050 -k qACMD09OJXBxT7XOuRs8 -z mesos.mydomain.com
To see other options, run:
To debug or verify everything is working, run with verbose/debug
-vvv. You will see lots of output including the full
Mesos cluster state, the resulting DNS record set, and all API calls
to NS1. You can also view the zone in the NS1 portal to confirm the
correct sets of records have been created.
For ongoing usage, it is recommended to run the connector via
or a similar scheduling tool every minute -- more often if you operate
a very dynamic environment, less often if your environment is very
static and you don't have strict service discovery requirements.
Also note that if you are using NS1's Managed DNS network and querying the records via your DNS resolver, you will need to run the connector with a registered domain for which NS1 has been made authoritative using the nameservers assigned when you create the zone.