External DNS automates DNS record management by watching Kubernetes resources and creating corresponding DNS entries. It’s widely used alongside Ingress controllers.
When migrating from Ingress to Gateway API, external-dns requires source configuration changes to watch Gateway API resources.
The key difference is adding Gateway API sources alongside or instead of Ingress sources.
Standard external-dns configuration for Ingress:
# values.yaml
sources:
- service
- ingress
provider: aws
policy: sync
registry: txt
txtOwnerId: my-cluster
domainFilters:
- example.com
Add Gateway API sources:
# values.yaml
sources:
- service
- gateway-httproute
- gateway-grpcroute
- gateway-tlsroute
- gateway-tcproute
- gateway-udproute
provider: aws
policy: sync
registry: txt
txtOwnerId: my-cluster
domainFilters:
- example.com
During migration, you can watch both Ingress and Gateway API resources:
# values.yaml
sources:
- service
- ingress
- gateway-httproute
- gateway-grpcroute
- gateway-tlsroute
- gateway-tcproute
- gateway-udproute
provider: aws
policy: sync
registry: txt
txtOwnerId: my-cluster
domainFilters:
- example.com
Running external-dns with both Ingress and Gateway API sources during migration allows gradual traffic cutover without DNS gaps.
Gateway API introduces multiple route types, each requiring its own source:
| Source | Resource | Use Case |
|---|---|---|
gateway-httproute | HTTPRoute | HTTP/HTTPS traffic |
gateway-grpcroute | GRPCRoute | gRPC traffic |
gateway-tlsroute | TLSRoute | TLS passthrough |
gateway-tcproute | TCPRoute | Raw TCP traffic |
gateway-udproute | UDPRoute | UDP traffic |
Add only the sources you need based on your route types.
External-dns annotations work similarly on both Ingress and Gateway API resources.
| Ingress Annotation | Gateway/Route Annotation | Notes |
|---|---|---|
external-dns.alpha.kubernetes.io/hostname | external-dns.alpha.kubernetes.io/hostname | Same annotation |
external-dns.alpha.kubernetes.io/ttl | external-dns.alpha.kubernetes.io/ttl | Same annotation |
external-dns.alpha.kubernetes.io/target | external-dns.alpha.kubernetes.io/target | Same annotation |
external-dns.alpha.kubernetes.io/alias | external-dns.alpha.kubernetes.io/alias | Same annotation |
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example
annotations:
external-dns.alpha.kubernetes.io/hostname: app.example.com
external-dns.alpha.kubernetes.io/ttl: "300"
spec:
ingressClassName: nginx
rules:
- host: app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: backend
port:
number: 80
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: example
annotations:
external-dns.alpha.kubernetes.io/hostname: app.example.com
external-dns.alpha.kubernetes.io/ttl: "300"
spec:
parentRefs:
- name: default
hostnames:
- app.example.com
rules:
- backendRefs:
- name: backend
port: 80
With Gateway API, external-dns can also derive hostnames from the route’s hostnames field without requiring annotations:
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: example
# No annotation needed - hostname derived from spec
spec:
parentRefs:
- name: default
hostnames:
- app.example.com # external-dns creates DNS record for this
rules:
- backendRefs:
- name: backend
port: 80
Be aware of these limitations when migrating external-dns to Gateway API.
We didn’t find any significant limitations during our migrations and testing. Everything worked as expected and seamlessly. Although, some things to be aware of:
External-dns needs the Gateway’s IP address to create DNS records. Ensure your Gateway has a LoadBalancer service with an assigned external IP before routes can get DNS records.
If multiple HTTPRoutes specify the same hostname, external-dns creates a single DNS record pointing to the Gateway IP. This is expected behavior since all routes share the same Gateway ingress point.
External-dns uses TXT records for ownership tracking. When migrating, the txtOwnerId should remain the same to avoid orphaned records. If you change the owner ID, old records won’t be cleaned up automatically.
Annotations can be placed on either the Gateway or the Route:
During migration, be consistent about where you place annotations.