Skip to content

Latest commit

 

History

History

external-dns

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

ExternalDNS

Links

References

Guides

Glossary

  • Strict Transport Security (STS)
  • Message Transfer Agent (MTA)

Helm

References

Repository

helm repo add external-dns 'https://kubernetes-sigs.github.io/external-dns'
helm repo update

Install

Cloudflare

Dependencies: Cloudflare

#
helm search repo -l external-dns/external-dns

#
export DOMAIN='xyz.tld'
# export CF_API_TOKEN='<api-token>'
export CF_API_KEY='<api-key>'
export CF_API_EMAIL='<email>'

#
helm install external-dns external-dns/external-dns \
  --namespace kube-system \
  --version 1.12.0 \
  -f <(cat << EOF
env:
  # - name: CF_API_TOKEN
  #   value: $CF_API_TOKEN
  - name: CF_API_KEY
    value: $CF_API_KEY
  - name: CF_API_EMAIL
    value: $CF_API_EMAIL

domainFilters:
  - $DOMAIN

provider: cloudflare

extraArgs:
  - --cloudflare-proxied
EOF
)

Status

kubectl rollout status deploy/external-dns \
  -n kube-system

Logs

kubectl logs \
  -l 'app.kubernetes.io/name=external-dns' \
  -n kube-system \
  -f

Test

#
export DOMAIN='xyz.tld'

#
cat << EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: docker.io/library/nginx:latest
        name: nginx
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: nginx
  annotations:
    external-dns.alpha.kubernetes.io/hostname: nginx.${K8S_DOMAIN}
    external-dns.alpha.kubernetes.io/ttl: '120'
spec:
  selector:
    app: nginx
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
EOF

#
kubectl get service nginx -o yaml

#
kubectl delete service/nginx
kubectl delete deployment/nginx

Tips

Annotations

#
kubens <namespace>

export DOMAIN='xyz.tld'
export SUBDOMAIN='<subdomain>'
export INGRESS_NAME='<name>'

#
kubectl annotate ingress "$INGRESS_NAME" "external-dns.alpha.kubernetes.io/target=$SUBDOMAIN.$DOMAIN"
kubectl annotate ingress "$INGRESS_NAME" 'external-dns.alpha.kubernetes.io/ttl=120'

Issues

TBD

time="2023-01-17T01:53:33Z" level=error msg="Failure in zone xyz.tld. [Id: /hostedzone/Z0452713392NDA7C5SB4P]"
time="2023-01-17T01:53:33Z" level=error msg="InvalidChangeBatch: [RRSet of type TXT with DNS name grafana.xyz.tld. is not permitted because a conflicting RRSet of type CNAME with the same DNS name already exists in zone xyz.tld., RRSet of type TXT with DNS name n8n.xyz.tld. is not permitted because a conflicting RRSet of type CNAME with the same DNS name already exists in zone xyz.tld.]\n\tstatus code: 400, request id: <UUID>"
time="2023-01-17T01:53:33Z" level=error msg="failed to submit all changes for the following zones: [/hostedzone/Z0452713392NDA7C5SB4P]"

TODO

Wrong Environment Variable

time="2023-01-05T15:27:17Z" level=error msg="Invalid request headers (6003)"

Related: Issue 342

Instead of use CF_API_KEY change to CF_API_TOKEN.

Wrong Endpoint

time="2019-09-18T13:53:03Z" level=error msg="context deadline exceeded"

Wrong etcd endpoints are configured.

helm get values external-dns | \
  yq r - coredns.etcdEndpoints

Delete

helm uninstall external-dns \
  -n external-dns