Skip to main content

external-dns

external-dns watches Kubernetes resources and writes the DNS records their hostnames need into a DNS provider. The GCP Web App Blueprint runs two releases per stage cluster, one for the stage's public zone and one for the internal zone, so no record of the application is written by hand.

What it does​

external-dns reads hostnames from sources such as Services, Ingresses and Gateway API HTTPRoutes, and creates matching records pointing at the addresses those resources receive. A domain filter limits it to one zone's names. A TXT registry records which records each instance owns, under an owner ID, so it never touches records it did not create. With the sync policy it also deletes records whose source is gone; upsert-only never deletes.

How BuiltForProd uses it​

ReleaseUnitZoneWrites
external-dnsexternal-dnsThe stage's public zone, such as prod.company.com, in acme-core-dnsblueprint-api.<stage>.company.com from the chart's HTTPRoute
ext-dns-intexternal-dns-internalinternal.company.com in acme-core-networkargocd.<stage>.internal.company.com from the ArgoCD HTTPRoute

Both use chart 1.23.0 in kube-system on the tainted system pool, watch service, ingress and gateway-httproute sources every minute, run the sync policy and register ownership with the owner ID <prefix>-gke-<release>. An @optional line in the public unit switches it to upsert-only. The zone name and project come from the landing-zone contract.

One zone each. Each release's Kubernetes service account is bound through Workload Identity Federation for GKE, directly as an IAM principal, to roles/dns.admin on its own zone only. The stage deployer writes that binding, which it can do because the Baseline made it roles/dns.admin of exactly those two zones; see Cloud DNS. Listing a project's zones is a project-level permission that zone IAM cannot grant, so the Baseline also gives each release roles/dns.reader on acme-core-dns or acme-core-network, for every stage listed in webapp_gke_stages of environments/plat/plat.hcl.

What it does not write. The SPA's A record and the Certificate Manager DNS authorization records are written by OpenTofu in the frontend-service and api-gateway units, not by external-dns; see Certificate Manager.

Terms you will see​

TermMeaning
SourceA Kubernetes resource type external-dns reads hostnames from.
Domain filterThe zone name a release is limited to.
TXT registryTXT records that mark which records a release owns.
sync policyCreate, update and delete the release's records to match the sources.
ext-dns-intThe release that writes the internal zone.

Where to read more​