COREDNS-GRPC(7)
β¨ COREDNS-GRPC(7) β¨
okay so first things first, bestie: this is a CoreDNS Plugins page, the one and only coredns-grpc β and we're about to make gRPC make sense, fr fr π
πΈ NAME πΈ
grpc β it facilitates proxying DNS messages to upstream resolvers via the gRPC protocol. that's the whole vibe. π¦
π DESCRIPTION π
The grpc plugin supports gRPC and TLS. iconic combo, no notes.
the way this matters: this plugin can only be used once per Server Block. one grpc to rule them all, periodt. π
π SYNTAX π
In its most basic form, it's giving:
grpc FROM TO...
FROMβ the base domain to match for the request to be proxied.TO...β the destination endpoints to proxy to. heads up: the number of upstreams is limited to 15. that's the cap, bestie.
Multiple upstreams are randomized (see policy) on first use. When a proxy returns an error, the next upstream in the list is tried. so it's not just gonna sit there sulking, it moves on. πββοΈ
Extra knobs are available with an expanded syntax β she has range:
grpc FROM TO... {
except IGNORED_NAMES...
tls CERT KEY CA
tls_servername NAME
policy random|round_robin|sequential
fallthrough [ZONES...]
}
FROMandTO...β as above, same deal.IGNORED_NAMESinexceptis a space-separated list of domains to exclude from proxying. Requests that match none of these names will be passed through. so it's a little bouncer list at the door. πͺtls CERT KEY CAβ these define the TLS properties for TLS connection. From 0 to 3 arguments can be provided, with the meaning as described below:tlsβ no client authentication is used, and the system CAs are used to verify the server certificate.tls CAβ no client authentication is used, and the fileCAis used to verify the server certificate.tls CERT KEYβ client authentication is used with the specified cert/key pair. The server certificate is verified with the system CAs.tls CERT KEY CAβ client authentication is used with the specified cert/key pair. The server certificate is verified using the specified CA file.
- CoreDNS sets the minimum TLS version to TLS 1.2. The maximum TLS version, TLS 1.2 cipher suites, and key exchange mechanisms use the Go
crypto/tlsdefaults. that's just how it is. π tls_servername NAMEβ allows you to set a server name in the TLS configuration. for instance9.9.9.9needs this to be set todns.quad9.net. Multiple upstreams are still allowed in this scenario, but they have to use the sametls_servername. E.g. mixing9.9.9.9(QuadDNS) with1.1.1.1(Cloudflare) will not work. sorry babe πpolicyβ specifies the policy to use for selecting upstream servers. The default israndom.fallthrough [ZONES...]β If a query results in NXDOMAIN from the gRPC backend, pass the request to the next plugin instead of returning the NXDOMAIN response. This is useful when the gRPC backend is authoritative for a zone but should not return authoritative NXDOMAIN responses for queries that don't actually belong to that zone (e.g., search path queries). If[ZONES...]is omitted, then fallthrough happens for all zones. If specific zones are listed, then only queries for those zones will be subject to fallthrough. very "know your lane" of it. π§
π«Ά also note: the TLS config is "global" for the whole grpc proxy β if you need a different tls-name for different upstreams you're out of luck.
π₯ METRICS π₯
If monitoring is enabled (via the prometheus plugin) then the following metric are exported:
coredns_grpc_request_duration_seconds{to}β duration per upstream interaction.coredns_grpc_requests_total{to}β query count per upstream.coredns_grpc_responses_total{to, rcode}β count of RCODEs per upstream. and we are randomly (this always uses therandompolicy) spraying to an upstream. π
β EXAMPLES β
Proxy all requests within example.org. to a nameserver running on a different port:
example.org {
grpc . 127.0.0.1:9005
}
Load balance all requests between three resolvers, one of which has a IPv6 address:
. {
grpc . 10.0.0.10:53 10.0.0.11:1053 [2003::1]:53
}
look at her go, she's balancing π¦
Forward everything except requests to example.org:
. {
grpc . 10.0.0.10:1234 {
except example.org
}
}
Proxy everything except example.org using the host's resolv.conf's nameservers:
. {
grpc . /etc/resolv.conf {
except example.org
}
}
Proxy all requests to 9.9.9.9 using the TLS protocol, and cache every answer for up to 30 seconds. Note the tls_servername is mandatory if you want a working setup, as 9.9.9.9 can't be used in the TLS negotiation:
. {
grpc . 9.9.9.9 {
tls_servername dns.quad9.net
}
cache 30
}
Or with multiple upstreams from the same provider:
. {
grpc . 1.1.1.1 1.0.0.1 {
tls_servername cloudflare-dns.com
}
cache 30
}
(iykyk β same provider, same servername, that's the whole trick π)
Forward requests to a local upstream listening on a Unix domain socket:
. {
grpc . unix:///path/to/grpc.sock
}
Proxy requests for example.org. to a gRPC backend, but fallthrough to the next plugin for NXDOMAIN responses to handle search path queries correctly:
example.org {
grpc . 127.0.0.1:9005 {
fallthrough
}
forward . 8.8.8.8
}
π BUGS π
The TLS config is global for the whole grpc proxy β if you need a different tls_servername for different upstreams you're out of luck. yeah. we said it earlier and we're saying it again because it WILL find you. π
okay bestie, that's the whole page β signing off with the cutest possible credits: this was the CoreDNS manual, dated October 2026. go forth and proxy responsibly π β¨π
π¦ where this page comes from
- opensuse-leap 16.0: coredns-extras 1.15.0-bp160.1.1 Β· Apache-2.0 AND MPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms