External dns

From TerminalSkills/skills · View interactive version

External dns is an AI agent skill from the GitHub repository TerminalSkills/skills. ExternalDNS automatically creates and updates DNS records for Kubernetes Services, Ingresses, Gateway API routes and Istio resources in providers such as Route 53, Cloud DNS and Cloudflare. Use when someone asks to "point a hostname at my Kubernetes service automatically", "install external-dns with

How to use this skill

Skill file

ExternalDNS

Overview

ExternalDNS runs as a controller in the cluster, reads hostnames from Services (type LoadBalancer), Ingresses, Gateway API routes, Istio Gateways and other sources, and creates matching records in your DNS provider. Ownership is tracked with TXT records (--registry=txt plus a unique --txt-owner-id), so it only touches records it created. Checked against Helm chart 1.23.0 (app v0.23.0; v0.24.0 was released on 2026-10-23).

Three changes from older guides matter:

Instructions

Install with Helm

helm repo add external-dns https://kubernetes-sigs.github.io/external-dns/
helm repo update
helm install external-dns external-dns/external-dns \
  --namespace external-dns --create-namespace \
  --version 1.23.0 \
  --values values.yaml

Preview what a values file produces before installing: helm template external-dns external-dns/external-dns --version 1.23.0 -f values.yaml | grep -- '- --' lists the controller arguments.

AWS Route 53

# values-aws.yaml
provider:
  name: aws
env:
  - name: AWS_DEFAULT_REGION
    value: us-east-1
sources:
  - service
  - ingress
domainFilters:
  - shop.northwind-example.org
policy: upsert-only        # creates and updates, never deletes
registry: txt
txtOwnerId: prod-eks-1     # unique per cluster
extraArgs:
  - --aws-zone-type=public
serviceAccount:
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/external-dns
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["route53:ChangeResourceRecordSets", "route53:ListResourceRecordSets", "route53:ListTagsForResources"],
      "Resource": ["arn:aws:route53:::hostedzone/Z0123456789ABCDEFGHIJ"]
    },
    {
      "Effect": "Allow",
      "Action": ["route53:ListHostedZones"],
      "Resource": ["*"]
    }
  ]
}

Attach the policy to an IAM role trusted by the cluster's service account (IRSA or EKS Pod Identity).

Google Cloud DNS

# values-gcp.yaml
provider:
  name: google
sources: [service, ingress]
domainFilters: [shop.northwind-example.org]
policy: sync
registry: txt
txtOwnerId: prod-gke-1
extraArgs:
  - --google-project=northwind-prod
  - --google-zone-visibility=public

The pod needs DNS admin rights on the zone, normally through Workload Identity.

Cloudflare

Create an API token with Zone Read and DNS Edit permissions, restricted to the zones you use (then also pass --zone-id-filter). Create the secret from the environment so the token never lands in a file:

kubectl create namespace external-dns
printf '%s' "$CLOUDFLARE_API_TOKEN" | kubectl -n external-dns create secret generic cloudflare-api-token --from-file=api-token=/dev/stdin
# values-cloudflare.yaml
provider:
  name: cloudflare
env:
  - name: CF_API_TOKEN
    valueFrom:
      secretKeyRef:
        name: cloudflare-api-token
        key: api-token
sources: [service, ingress]
domainFilters: [shop.northwind-example.org]
policy: sync
txtOwnerId: prod-k3s-1
extraArgs:
  - --cloudflare-proxied      # orange-cloud every record; override per resource with the annotation
  # proxied records: leave the ttl annotation unset or set it to 1 (automatic)

Do not set CF_API_KEY or CF_API_EMAIL together with CF_API_TOKEN.

Service and Ingress annotations

# service-lb.yaml
apiVersion: v1
kind: Service
metadata:
  name: web-app
  annotations:
    external-dns.kubernetes.io/hostname: app.shop.northwind-example.org
    external-dns.kubernetes.io/ttl: "300"
spec:
  type: LoadBalancer
  selector:
    app: web-app
  ports:
    - port: 80
      targetPort: 8080

Several hostnames: external-dns.kubernetes.io/hostname: "api.shop.northwind-example.org,api-v2.shop.northwind-example.org". Per-record Cloudflare proxying: external-dns.kubernetes.io/cloudflare-proxied: "true". A fixed target instead of the load balancer address: external-dns.kubernetes.io/target.

An Ingress needs no hostname annotation: hosts in spec.rules[].host are used, and the target comes from the Ingress load balancer status.

# ingress-dns.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: web-app
  annotations:
    external-dns.kubernetes.io/ttl: "120"
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - app.shop.northwind-example.org
      secretName: app-tls
  rules:
    - host: app.shop.northwind-example.org
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: web-app
                port:
                  number: 80

Other sources

Set sources to what you run: istio-gateway, istio-virtualservice, gateway-httproute (Gateway API; annotation placement differs by route type, see the annotations doc), crd, node, pod. The chart creates the matching RBAC rules for the sources you list.

# values-istio.yaml
provider:
  name: aws
sources: [istio-gateway, istio-virtualservice]
domainFilters: [shop.northwind-example.org]
policy: sync
txtOwnerId: prod-eks-1

Operate and debug

kubectl -n external-dns logs deploy/external-dns -f      # "All records are already up to date" when in sync
dig +short app.shop.northwind-example.org
dig +short TXT app.shop.northwind-example.org            # ownership TXT records (heritage=external-dns,...)

Add --dry-run to extraArgs to log planned changes without applying them.

Examples

Example 1: Publish a shop on Route 53 without deleting anything

User: "Install external-dns on our EKS cluster so app.shop.northwind-example.org points at the ingress, and make sure it never deletes records."

Create the IAM role and values-aws.yaml above (policy: upsert-only), then helm install ... --version 1.23.0 -f values-aws.yaml. Logs show Desired change: CREATE app.shop.northwind-example.org A followed by a matching TXT record; dig +short app.shop.northwind-example.org returns the load balancer addresses after the TTL.

Example 2: Records stopped appearing after an upgrade

User: "After upgrading external-dns, none of my annotated services get DNS records and some old ones vanished."

The annotations still use external-dns.alpha.kubernetes.io/. Switch them to external-dns.kubernetes.io/ (hostname, ttl, target, cloudflare-proxied), or temporarily add --enable-legacy-annotation-prefix to extraArgs (reads both prefixes; v0.23+). Set policy: upsert-only and --dry-run while checking logs, then restore the real policy.

Guidelines

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.