### Initialize documentation development environment Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/contributing/dev-guide Commands to enter a virtual environment, install documentation dependencies, and start the local MkDocs server. ```bash ❯❯ pipenv shell ❯❯ pip install -r docs/scripts/requirements.txt ❯❯ mkdocs serve $$ ... $$ Serving on http://127.0.0.1:8000/ ``` -------------------------------- ### EKS configuration example Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/tutorials/aws An effective starting point for EKS with an ingress controller, using a 5-minute interval, events, ingress source, domain filter, and zone cache duration. ```text --interval=5m --events --source=ingress --domain-filter=example.com --aws-zones-cache-duration=1h ``` -------------------------------- ### Example startup flags output Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/contributing/bug-report An example of the expected format for startup flags. ```text --provider=aws --registry=txt --txt-owner-id=my-cluster --source=ingress --domain-filter=example.com --log-level=debug ``` -------------------------------- ### Example nameserver output Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/tutorials/aws Example output from the previous command showing the nameservers assigned to the new hosted zone. ```text ns-695.awsdns-22.net. ns-1313.awsdns-36.org. ns-350.awsdns-43.com. ns-1805.awsdns-33.co.uk. ``` -------------------------------- ### BIND zone file example Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/tutorials/rfc2136 Example content for a BIND zone file. ```text $TTL 60 ; 1 minute k8s.example.org IN SOA k8s.example.org. root.k8s.example.org. ( 16 ; serial 60 ; refresh (1 minute) 60 ; retry (1 minute) 60 ; expire (1 minute) 60 ; minimum (1 minute) ) NS ns.k8s.example.org. ns A 123.456.789.012 ``` -------------------------------- ### Delete tutorial example resources Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/tutorials/ovh Deletes the example resources created during the tutorial, including the nginx deployment and the ExternalDNS configuration. ```bash kubectl delete -f nginx.yaml kubectl delete -f externaldns.yaml ``` -------------------------------- ### Install Sample Service Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/sources/contour Command to apply a sample Deployment and Service to the cluster. ```bash $ kubectl apply -f - < \ --log-format=text \ --log-level=debug \ --interval=1m --provider=xxx --source=yyy ``` -------------------------------- ### Configure GKE and DNS Projects Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/tutorials/gke Set environment variables and enable necessary APIs for both the GKE workload project and the Cloud DNS project. ```bash # set variables to appropriate desired values GKE_PROJECT_ID="my-workload-project" DNS_PROJECT_ID="my-cloud-dns-project" ClOUD_BILLING_ACCOUNT="" # enable billing and APIs for DNS project if not done already gcloud config set project $DNS_PROJECT_ID gcloud beta billing projects link $CLOUD_DNS_PROJECT \ --billing-account $ClOUD_BILLING_ACCOUNT gcloud services enable "dns.googleapis.com" # enable billing and APIs for GKE project if not done already gcloud config set project $GKE_PROJECT_ID gcloud beta billing projects link $CLOUD_DNS_PROJECT \ --billing-account $ClOUD_BILLING_ACCOUNT gcloud services enable "container.googleapis.com" ``` -------------------------------- ### Combine annotation key and value filters Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/advanced/fqdn-templating This example shows a Service with annotations and a template that filters by both key containing 'dns/' and value containing 'example.com'. The result is a comma-separated list of matching values. ```yaml apiVersion: v1 kind: Service metadata: name: my-service annotations: dns/primary: api.example.com dns/secondary: api-backup.example.com other/hostname: internal.other.org # Won't match - value doesn't contain "example.com" logging/level: debug # Won't match - key doesn't contain "dns/" ``` ```yaml args: --fqdn-template='{{ if eq .Kind "Service" }}{{ range $k, $v := .Annotations }}{{ if and (contains $k "dns/") (contains $v "example.com") }}{{ $v }}{{ printf "," }}{{ end }}{{ end }}{{ end }}' # Result: api.example.com, api-backup.example.com ``` -------------------------------- ### DNSEndpoint manifest for DNAME record Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/sources/crd Example configuration for a DNAME record. ```yaml apiVersion: externaldns.k8s.io/v1alpha1 kind: DNSEndpoint metadata: name: dname-record spec: endpoints: - dnsName: sub.example.com recordTTL: 300 recordType: DNAME targets: - example.net ``` -------------------------------- ### Create and configure Minikube cluster Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/contributing/dev-guide Initialize a local Minikube cluster with specific resource constraints and Kubernetes version, then set the active profile. ```bash minikube start \ --profile=external-dns \ --memory=2000 \ --cpus=2 \ --disk-size=5g \ --kubernetes-version=v1.31 \ --driver=docker minikube profile external-dns ``` -------------------------------- ### DNSEndpoint manifest for NS record Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/sources/crd Example configuration for an NS record. ```yaml apiVersion: externaldns.k8s.io/v1alpha1 kind: DNSEndpoint metadata: name: ns-record spec: endpoints: - dnsName: zone.example.com recordTTL: 300 recordType: NS targets: - ns1.example.com - ns2.example.com ``` -------------------------------- ### DNSEndpoint manifest for CNAME record Source: https://kubernetes-sigs.github.io/external-dns/latest/docs/sources/crd Example configuration for a CNAME record. ```yaml apiVersion: externaldns.k8s.io/v1alpha1 kind: DNSEndpoint metadata: name: examplecnamerecord spec: endpoints: - dnsName: test-a.example.com recordTTL: 300 recordType: CNAME targets: - example.com ```