Skip to content

A Kubernetes controller that registers Meraki device clients in DNS via external-dns

Notifications You must be signed in to change notification settings

ryane/meraki-external-dns-source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meraki-external-dns-source

A Kubernetes controller that registers Meraki device clients in DNS via the external-dns CRD Source.

Background

I was lucky enough to have been gifted a couple of Meraki devices: a Z1 and an MX69. I primarily use them as a simple way to run a Site-to-site VPN between my home and office space and it is helpful to have all of my client devices registered in DNS. This controller will discover all of the devices in a Meraki Network as defined by the MerakiSource CRD and set the list of active clients as endpoints in a new or existing external-dns DNSEndpoint resource. external-dns does the actual DNS registration in your configured provider.

This is pretty niche but perhaps it will be useful to someone else.

MerakiSource

Each MerakiSource represents a Network defined in your Organization. The domain specifies the domain suffix for all discovered Clients.

Examples

Consider the following MerakiSource:

apiVersion: dns.jossware.com/v1alpha1
kind: MerakiSource
metadata:
  name: office
spec:
  organization:
    id: "999999"
  network:
    id: N_111111111111111111
  domain: office.internal.example.com
  ttl: 60

The controller will find all the Clients in the Network and add them to the .spec.endpoints list in a DNSEndpoint resource named after the network. For example:

kubectl get dnsendpoint office -ojson | jq .spec

{
  "endpoints": [
    {
      "dnsName": "lab01.office.internal.example.com",
      "recordTTL": 60,
      "recordType": "A",
      "targets": [
        "192.168.128.5"
      ]
    },
    {
      "dnsName": "rt-ac66u-7d00.office.internal.example.com",
      "recordTTL": 60,
      "recordType": "A",
      "targets": [
        "192.168.128.7"
      ]
    },
    {
      "dnsName": "silicon.office.internal.example.com",
      "recordTTL": 60,
      "recordType": "A",
      "targets": [
        "192.168.128.14"
      ]
    },
    {
      "dnsName": "pi01.office.internal.example.com",
      "recordTTL": 60,
      "recordType": "A",
      "targets": [
        "192.168.128.13"
      ]
    }
  ]
}

At this point, assuming it is configured correctly, external-dns will see the DNSEndpoint and register the DNS records in your chosen provider.

About

A Kubernetes controller that registers Meraki device clients in DNS via external-dns

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published