Deploy scoped Cloudflare ExternalDNS for public routes

This commit is contained in:
feedc0de committed 2026-11-24 15:10:49 +01:00
1 parent 25ec5c3322
commit d5ad816ad3
6 files changed
+99

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
# ExternalDNS
ExternalDNS uses a Cloudflare token scoped to DNS read/write and zone read for
`brunner.ninja`. The token is stored only in the cluster Secret
`external-dns/cloudflare-token`. Argo CD manages the controller, but not the
credential.
To publish a new public route, give its Ingress or Traefik IngressRoute these
annotations:
```yaml
external-dns.brunner.ninja/enabled: "true"
external-dns.kubernetes.io/target: brunner.ninja
```
The route host becomes an unproxied CNAME to `brunner.ninja`. Traefik
IngressRoutes require the target annotation because they have no load balancer
status. Existing routes without the opt-in annotation remain untouched.
ExternalDNS only creates or updates records; it does not delete them when a
route is removed. This avoids removing existing records during adoption.
+20
View File
@@ -0,0 +1,20 @@
provider:
name: cloudflare
sources:
- ingress
- traefik-proxy
policy: upsert-only
registry: txt
txtOwnerId: homelab
txtPrefix: external-dns-
domainFilters:
- brunner.ninja
annotationFilter: external-dns.brunner.ninja/enabled=true
env:
- name: CF_API_TOKEN
valueFrom:
secretKeyRef:
name: cloudflare-token
key: token
serviceMonitor:
enabled: true
+2
View File
@@ -25,6 +25,8 @@ ingress:
annotations:
traefik.ingress.kubernetes.io/router.middlewares: default-authentik@kubernetescrd
traefik.ingress.kubernetes.io/router.entrypoints: websecure
external-dns.brunner.ninja/enabled: "true"
external-dns.kubernetes.io/target: brunner.ninja
peerService:
annotations:
mikrotik.brunner.ninja/router: newgw
+27
View File
@@ -0,0 +1,27 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: external-dns
namespace: argocd
spec:
description: Cloudflare DNS records for selected homelab routes
sourceRepos:
- https://kubernetes-sigs.github.io/external-dns/
- https://code.brunner.ninja/feedc0de/homelab-gitops.git
destinations:
- namespace: external-dns
server: https://kubernetes.default.svc
clusterResourceWhitelist:
- group: rbac.authorization.k8s.io
kind: ClusterRole
- group: rbac.authorization.k8s.io
kind: ClusterRoleBinding
namespaceResourceWhitelist:
- group: ""
kind: Service
- group: ""
kind: ServiceAccount
- group: apps
kind: Deployment
- group: monitoring.coreos.com
kind: ServiceMonitor
+28
View File
@@ -0,0 +1,28 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: external-dns
namespace: argocd
spec:
project: external-dns
sources:
- repoURL: https://kubernetes-sigs.github.io/external-dns/
chart: external-dns
targetRevision: 1.24.0
helm:
releaseName: external-dns
valueFiles:
- $values/apps/external-dns/values.yaml
- repoURL: https://code.brunner.ninja/feedc0de/homelab-gitops.git
targetRevision: main
ref: values
destination:
server: https://kubernetes.default.svc
namespace: external-dns
syncPolicy:
automated:
enabled: true
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
+2
View File
@@ -40,6 +40,8 @@ resources:
- cert-manager-project.yaml
- brave-sync.yaml
- cert-manager.yaml
- external-dns-project.yaml
- external-dns.yaml
- metallb-project.yaml
- metallb.yaml
- cilium-project.yaml