Files
coredns/middleware/etcd
Miek Gieben c30671f4c0 Allow debug queries to etcd middleware (#150)
With this you can retreive the raw data that the etcd middleware
used to create the reply. The debug data is put in TXT records
that are stuffed in the CH classs. This is only enabled if you
specify `debug` in the etcd stanza.

You can retrieve it by prefixing your query with 'o-o.debug.'
For instance:

; <<>> DiG 9.10.3-P4-Ubuntu <<>> @localhost -p 1053 SRV o-o.debug.production.*.skydns.local
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47798
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;o-o.debug.production.*.skydns.local. IN	SRV

;; ANSWER SECTION:
production.*.skydns.local. 154	IN	SRV	10 50 8080 service1.example.com.
production.*.skydns.local. 154	IN	SRV	10 50 8080 service2.example.com.

;; ADDITIONAL SECTION:
skydns.local.skydns.east.production.rails.1. 154 CH TXT	"service1.example.com:8080(10,0,,false)[0,]"
skydns.local.skydns.west.production.rails.2. 154 CH TXT	"service2.example.com:8080(10,0,,false)[0,]"
2016-05-22 21:16:26 +01:00
..
2016-03-23 10:41:40 +00:00
2016-03-23 10:41:40 +00:00
2016-04-26 17:57:11 +01:00
2016-04-12 21:50:01 +01:00
2016-04-12 21:30:08 +01:00

etcd

etcd enabled reading zone data from an etcd instance. The data in etcd has to be encoded as a message like SkyDNS. It should also work just like SkyDNS.

The etcd middleware makes extensive use of the proxy middleware to forward and query other servers in the network.

Syntax

etcd [zones...]
  • zones zones etcd should be authoritative for.

The path will default to /skydns the local etcd proxy (http://localhost:2379). If no zones are specified the block's zone will be used as the zone.

If you want to round robin A and AAAA responses look at the loadbalance middleware.

etcd [zones...] {
    stubzones
    path /skydns
    endpoint endpoint...
    upstream address...
    tls cert key cacert
    debug
}
  • stubzones enable the stub zones feature. The stubzone is only done in the etcd tree located under the first zone specified.

  • path the path inside etcd, defaults to "/skydns".

  • endpoint the etcd endpoints, default to "http://localhost:2397".

  • upstream upstream resolvers to be used resolve external names found in etcd, think CNAMEs pointing to external names. If you want CoreDNS to act as a proxy for clients you'll need to add the proxy middleware.

  • tls followed the cert, key and the CA's cert filenames.

  • debug allow debug queries. Prefix the name with o-o.debug. to reveive extra information in the additional section of the reply in the form of text records:

    skydns.test.skydns.dom.a. 300 CH TXT "127.0.0.1:0(10,0,,false)[0,]"

    This shows the complete key as the owername, the rdata of the TXT record has: host:port(priority,weight,txt content,mail)[targetstrip,group].

Examples

This is the default SkyDNS setup, with everying specified in full:

.:53 {
    etcd skydns.local {
        stubzones
        path /skydns
        endpoint http://localhost:2379
        upstream 8.8.8.8:53 8.8.4.4:53
    }
    prometheus
    cache 160 skydns.local
    loadbalance
    proxy . 8.8.8.8:53 8.8.4.4:53
}