COREDNS-K8S_EXTERNAL(7)
π
k8s_external β CoreDNS plugin (manual page COREDNS-K8S_EXTERNAL(7))
okay so bestie, welcome to the k8s_external page from the CoreDNS plugins manual β¨ this one is all about resolving the load balancer and external IPs from outside your Kubernetes clusters, and β if you flip the right switch β headless services too π
πΈ NAME πΈ
k8s_external β resolves load balancer, external IPs from outside Kubernetes clusters and if enabled headless services.
π¦ DESCRIPTION π¦
So this plugin gives you an additional zone that resolves the external IP address(es) of a Kubernetes service, plus headless services. The catch? It's only useful if the kubernetes plugin is also loaded. Like, they're a package deal, iykyk π
The plugin uses an external zone to resolve in-cluster IP addresses. It only handles queries for A, AAAA, SRV, and PTR records β and to make it a proper DNS zone, it handles SOA and NS queries for the apex of the zone. No cap, that's the whole roster π
By default the apex of the zone will look like the following (assuming the zone used is example.org):
example.org. 5 IN SOA ns1.dns.example.org. hostmaster.example.org. (
12345 ; serial
7200 ; refresh (2 hours)
1800 ; retry (30 minutes)
86400 ; expire (1 day)
5 ; minimum (5 seconds)
)
example.org 5 IN NS ns1.dns.example.org.
ns1.dns.example.org. 5 IN A ....
ns1.dns.example.org. 5 IN AAAA ....
Note that we use the dns subdomain for the records DNS needs (see the apex directive). Also note the SOA's serial number is static β it does not move, it does not slay, it just sits there π
The IP addresses of the nameserver records are those of the CoreDNS service.
The k8s_external plugin handles the subdomain dns and the apex of the zone itself; all other queries are resolved to addresses in the cluster. periodt π«Ά
β¨ SYNTAX β¨
k8s_external [ZONE...]
- ZONES β the zones
k8s_externalshould be authoritative for.
If you want to change the apex domain or use a different TTL for the returned records you can use this extended syntax π
k8s_external [ZONE...] {
apex APEX
ttl TTL
}
- APEX β the name (DNS label) to use for the apex records; it defaults to
dns. ttlβ lets you set a custom TTL for responses. The default is5(seconds).
If you want to enable headless service resolution, you can do so by adding the headless option π§
k8s_external [ZONE...] {
headless
}
- if there is a headless service with external IPs set, external IPs will be resolved
If the queried domain does not exist, you can fall through to the next plugin by adding the fallthrough option π
k8s_external [ZONE...] {
fallthrough [ZONE...]
}
π₯ EXAMPLES π₯
Enable names under example.org to be resolved to in-cluster DNS addresses.
. {
kubernetes cluster.local
k8s_external example.org
}
With the Corefile above, the following Service will get an A record for test.default.example.org with the IP address 192.168.200.123 π
apiVersion: v1
kind: Service
metadata:
name: test
namespace: default
spec:
clusterIP: None
externalIPs:
- 192.168.200.123
type: ClusterIP
The k8s_external plugin can be used in conjunction with the transfer plugin to enable zone transfers. Notifies are not supported. π«
. {
transfer example.org {
to *
}
kubernetes cluster.local
k8s_external example.org
}
With the fallthrough option, if the queried domain does not exist, it will be passed to the next plugin that matches the zone.
. {
kubernetes cluster.local
k8s_external example.org {
fallthrough
}
forward . 8.8.8.8
}
For some background see resolve external IP address β¨https://github.com/kubernetes/dns/issues/242β©. And A records for services with Load Balancer IP β¨https://github.com/coredns/coredns/issues/1851β© π
lowkey a vibe check before you ship: this plugin is only useful if the kubernetes plugin is also loaded, so don't come for me if it's giving nothing without it π
π that's the whole page, bestie π courtesy of CoreDNS, dated March 2026 β go forth and resolve those external IPs, you absolute icon πβ¨
π¦ 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