A CoreDNS plugin that serves DNS records from external-dns DNSEndpoint CRDs.
- Watches Kubernetes Resources:
- DNSEndpoint CRDs for generic DNS record definitions
- Services (Type LoadBalancer) for automatic service discovery
- Ingresses for HTTP/HTTPS routing discovery
- Caches records in memory for fast DNS query responses
- Serves DNS queries directly from the cache
- Auto-generates PTR records when enabled via annotation
# Deploy with Helm
helm install coredns-externaldns oci://ghcr.io/ionos-cloud/coredns-externaldns/charts/coredns-externaldns
# Or build and run standalone
git clone https://github.com/ionos-cloud/coredns-externaldns
cd coredns-externaldns
make build
./coredns-externaldns -conf Corefile.standalone.:53 {
externaldns {
namespace default # Optional: watch specific namespace
ttl 300 # Optional: default TTL (seconds)
configmap_name zone-serials # Optional: ConfigMap for serial persistence
soa_ns ns1.example.com # Optional: SOA nameserver for AXFR
soa_mbox admin.example.com # Optional: SOA mailbox for AXFR
authoritative_zones example.com,test.com # Optional: explicit zone list
}
forward . 8.8.8.8
log
errors
}Configure authoritative_zones to define which DNS zones this plugin serves. This enables proper zone boundaries and DNS NOTIFY functionality.
By default, the plugin uses the zones from the Corefile where it's loaded (e.g., example.com:53). Setting authoritative_zones overrides this with an explicit zone list.
Format: Comma-separated zone list
authoritative_zones example.com,internal.local,test.netWith DNS NOTIFY:
transfer { to * }
externaldns {
authoritative_zones example.com
soa_ns ns1.example.com
}apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
name: example
annotations:
coredns-externaldns.ionos.cloud/create-ptr: "true" # Enable PTR records
spec:
endpoints:
- dnsName: app.example.com
recordType: A
targets: ["192.168.1.100"]
recordTTL: 300The plugin automatically creates DNS records for Services of type LoadBalancer.
- Service must be of type
LoadBalancer - Must have
external-dns.alpha.kubernetes.io/hostnameannotation
apiVersion: v1
kind: Service
metadata:
name: nginx
annotations:
external-dns.alpha.kubernetes.io/hostname: nginx.example.com
external-dns.alpha.kubernetes.io/ttl: "60"
coredns-externaldns.ionos.cloud/create-ptr: "true"
spec:
type: LoadBalancer
ports:
- port: 80
selector:
app: nginxThe plugin automatically creates DNS records for Ingress resources.
Hostnames are discovered from the following sources (can be combined):
- Explicit Hostname: Using
external-dns.alpha.kubernetes.io/hostnameannotation - From Rules: Using
coredns-externaldns.ionos.cloud/ingress-from-rules: "true"annotation to use hosts defined inspec.rules
If both are present, records will be created for all unique hostnames found.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx
annotations:
external-dns.alpha.kubernetes.io/hostname: nginx.example.com
coredns-externaldns.ionos.cloud/create-ptr: "true"
spec:
rules:
- host: nginx.internal
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx
port:
number: 80apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx
annotations:
coredns-externaldns.ionos.cloud/ingress-from-rules: "true"
spec:
rules:
- host: app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app
port:
number: 80The plugin can automatically create reverse DNS (PTR) records for A and AAAA records.
Add this annotation to your DNSEndpoint, Service, or Ingress:
metadata:
annotations:
coredns-externaldns.ionos.cloud/create-ptr: "true"- Forward Record:
app.example.com A 192.168.1.100 - Auto-Generated PTR:
100.1.168.192.in-addr.arpa PTR app.example.com
When you query 192.168.1.100 for reverse DNS, it returns app.example.com.
Supported: Works with both A (IPv4) and AAAA (IPv6) records.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: coredns-externaldns
rules:
- apiGroups: ["externaldns.k8s.io"]
resources: ["dnsendpoints"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["services", "configmaps"]
verbs: ["get", "list", "watch", "create", "update"]
- apiGroups: ["networking.k8s.io"]
resources: ["ingresses"]
verbs: ["get", "list", "watch"]A, AAAA, CNAME, MX, TXT, SRV, PTR, NS, SOA
Apache 2.0