/nomad-external-dns

Set external DNS records for Nomad services

Primary LanguageGoMIT LicenseMIT

nomad-external-dns

Synchronize Nomad Services with external DNS providers.

Inspired by kubernetes-sigs/external-dns, nomad-external-dns makes Nomad Services discoverable via DNS servers. Nomad 1.3+ bundles support for native service discovery and nomad-external-dns helps to advertise the services inside this registry to external DNS providers.

Supported Providers

How it Works

nomad-external-dns uses the concept of "Annotated Tags" to set properties for the DNS records. Here's an example of a service stanza inside a Nomad jobspec:

    service {
      provider = "nomad"
      name     = "redis-cache"
      tags = [
        "external-dns/hostname=redis.test.internal",
        "external-dns/ttl=30s",
      ]
      port = "db"
    }
  • At every app.update_interval frequency, list of all services across namespaces in the Nomad cluster are fetched.
  • For each service, external-dns prefix is used to determine properties like TTL, Hostname etc.
  • DNS record for this service is created with the registered DNS Provider. nomad-external-dns creates or updates an existing record automatically.

Deploy

NOTE: This is meant to run inside a Nomad cluster and should have proper ACL to query for services across multiple namespaces.

You can choose one of the various deployment options:

Binary

Grab the latest release from Releases.

To run:

$ ./nomad-external-dns.bin --config config.toml

Nomad

Refer to the jobspec for deploying in a Nomad cluster.

If you're deploying on AWS, consider referring to the IAM policy mentioned here

Configuration

Refer to config.sample.toml for a list of configurable values.

Environment Variables

All config variables can also be populated as env vairables by prefixing NOMAD_EXTERNAL_DNS_ and replacing . with __.

For eg: app.update_interval becomes NOMAD_EXTERNAL_DNS_app__update_interval.

For configuring Nomad API client, these environment variables can be set.

Contribution

  • Support for new providers can be added by registering more providers using libdns.
  • Feel free to report any bugs/feature requests.

LICENSE

LICENSE