docs/advanced/ttl.md
To customize DNS record TTL (Time-To-Live) in a DNS record
, you can use theexternal-dns.alpha.kubernetes.io/ttl: <duration>annotation or flag--min-ttl=<duration>. TTL is specified as an integer encoded as string representing seconds. Example;1s,1m2s,1h2m11s`
Behaviour:
external-dns.alpha.kubernetes.io/ttl annotation is set, it overrides the default TTL(0) value.--min-ttl flag is provided.0, and the --min-ttl=1s flag is provided, the value from --min-ttl will be used instead.To configure it, annotate a service/ingress, e.g.:
apiVersion: v1
kind: Service
metadata:
annotations:
external-dns.alpha.kubernetes.io/hostname: nginx.external-dns-test.my-org.com.
external-dns.alpha.kubernetes.io/ttl: "60"
...
TTL can also be specified as a duration value parsable by Golang time.ParseDuration:
apiVersion: v1
kind: Service
metadata:
annotations:
external-dns.alpha.kubernetes.io/hostname: nginx.external-dns-test.my-org.com.
external-dns.alpha.kubernetes.io/ttl: "1m"
...
Both examples result in the same value of 60 seconds TTL.
TTL must be a positive value.
Note: For TTL annotations to work, the
external-dns.alpha.kubernetes.io/hostnameannotation must be set on the resource and be supported by the provider as well as the source.
| Provider | Supported |
|---|---|
Akamai | Yes |
AlibabaCloud | Yes |
AWS | Yes |
AWSSD | Yes |
Azure | Yes |
Civo | No |
Cloudflare | Yes |
CoreDNS | No |
DNSSimple | Yes |
Exoscale | Yes |
Gandi | Yes |
GoDaddy | Yes |
Google GCP | Yes |
InMemory | No |
Linode | No |
NS1 | No |
OCI | Yes |
OVH | No |
PDNS | No |
PiHole | Yes |
Plural | No |
RFC2136 | Yes |
Scaleway | Yes |
Transip | Yes |
Webhook | Yes |
| Source | Supported |
|---|---|
ambassador-host | Yes |
connector | No |
contour-httpproxy | Yes |
crd | No |
empty | No |
f5-transportserver | Yes |
f5-virtualserver | Yes |
fake | No |
gateway-grpcroute | Yes |
gateway-httproute | Yes |
gateway-tcproute | Yes |
gateway-tlsroute | Yes |
gateway-udproute | Yes |
gloo-proxy | Yes |
ingress | Yes |
istio-gateway | Yes |
istio-virtualservice | Yes |
kong-tcpingress | Yes |
node | Yes |
openshift-route | Yes |
pod | Yes |
service | Yes |
skipper-routegroup | Yes |
traefik-proxy | Yes |
When the external-dns.alpha.kubernetes.io/ttl annotation is not provided, the TTL will default to 0 seconds and endpoint.TTL.isConfigured() will be false.
The AWS Provider overrides the value to 300s when the TTL is 0. This value is a constant in the provider code.
TTL value should be between 1 and 2,147,483,647 seconds. By default it will be 300s.
CloudFlare overrides the value to "auto" when the TTL is 0.
The DNSimple Provider default TTL is used when the TTL is 0. The default TTL is 3600s.
Previously with the Google Provider, TTL's were hard-coded to 300s. For safety, the Google Provider overrides the value to 300s when the TTL is 0. This value is a constant in the provider code.
For the moment, it is impossible to use a TTL value of 0 with the AWS or Google Providers. This behavior may change in the future.
The Linode Provider default TTL is used when the TTL is 0. The default is 24 hours
The TransIP Provider minimal TTL is used when the TTL is 0. The minimal TTL is 60s.
external-dns.alpha.kubernetes.io/ttl annotation and --min-ttl flag`The external-dns.alpha.kubernetes.io/ttl annotation allows you to set a custom TTL (Time To Live) for DNS records managed by external-dns.
Use the external-dns.alpha.kubernetes.io/tt annotation to fine-tune DNS caching behavior per record, balancing between update frequency and performance.
This is useful in several real-world scenarios depending on how frequently DNS records are expected to change.
For services that must be highly available—like APIs, databases, or external load balancers—set a low TTL (e.g., 30 seconds) so DNS clients quickly update to new IPs during:
annotations:
external-dns.alpha.kubernetes.io/ttl: "30s"
If your service’s IP or endpoint rarely changes (e.g., static websites, internal dashboards), you can set a long TTL (e.g., 86400 seconds = 24 hours) to:
annotations:
external-dns.alpha.kubernetes.io/ttl: "24h"
Use a short TTL for services under test or experimentation to allow fast DNS propagation when making changes, allowing easy rollback and testing.
Some DNS providers charge per query or have query rate limits. Adjusting the TTL lets you:
Certain environments may require TTL values to align with:
In environments like Google Cloud Platform (GCP) using private node IPs for DNS resolution, ExternalDNS may register node IPs with a default TTL of 300 seconds.
During autoscaling events (e.g., node addition/removal or upgrades), DNS records may remain stale for several minutes, causing traffic to be routed to non-existent nodes.
By using the TTL annotation you can: