Support Online
Skip to main content

Automatically Manage DigitalOcean Kubernetes DNS Records with ExternalDNS

In Kubernetes environments, it is standard to publish applications by domain.
However, manually managing DNS records is time-consuming and error-prone.

ExternalDNS completely automates this process.

What Will You Learn in This Guide?

In this guide:

  • Installing ExternalDNS on DOKS cluster with Helm
  • Automatically create DNS records for Service and Ingress resources
  • Manage A and TXT records with DigitalOcean DNS API
  • Testing Ingress and LoadBalancer scenarios

You will learn.


Technical Summary

This guide covers ExternalDNS on DigitalOcean Kubernetes (DOKS).
Describes automatic management of DNS records from Service and Ingress sources.

The aim is to eliminate manual DNS updates.
to integrate with application distribution.


What Problem Does It Solve?

  • Eliminates the risk of DNS forgetting when IP changes
  • Eliminates the need for a manual DNS panel
  • Makes Kubernetes the single source of truth
  • Speeds up CI/CD and testing environments

Prerequisites

  • DigitalOcean Kubernetes Cluster (DOKS)
  • kubectl must be configured
  • Helm 3 must be installed
  • Nginx Ingress Controller must be active
  • DigitalOcean API Key (read/write)
  • Registered domain name (example: ornek.com)

ExternalDNS Setup (Helm)

Configuration File

nano externaldns-values.yaml
  • This file contains ExternalDNS settings.


provider: digitalocean

digitalocean:
apiToken: YOUR_API_TOKEN

interval: "1m"
policy: sync
provider: DNS sağlayıcısı

interval: Değişiklik kontrol süresi

policy: Kayıt oluşturma/silme davranışı

Adding Helm Repository


helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
  • These commands add and update Bitnami charts.

ExternalDNS Setup


helm install external-dns bitnami/external-dns -f externaldns-values.yaml
  • ExternalDNS is installed on your cluster.

  • Check pod status:


kubectl get pods -l app.kubernetes.io/name=external-dns

Sample Application and Ingress


nano echo.yaml
  • This file contains Deployment, Service and Ingress definitions.


apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: echo-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: echo.ornek.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: echo
port:
number: 80
---
apiVersion: v1
kind: Service
metadata:
name: echo
spec:
ports:
- port: 80
targetPort: 5678
selector:
app: echo
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: echo
spec:
replicas: 3
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- name: echo
image: hashicorp/http-echo
args:
- "-text=Selam GenixNode!"
ports:
- containerPort: 5678

Creating Resources


kubectl apply -f echo.yaml
  • ExternalDNS creates DNS records in approximately 1 minute.

Test:


curl echo.ornek.com
  • Expected output:

Selam GenixNode!

(Optional) LoadBalancer Service Usage

  1. Uninstall Ingress:

kubectl delete ingress echo-ingress
  1. Update the service:

apiVersion: v1
kind: Service
metadata:
name: echo
annotations:
external-dns.alpha.kubernetes.io/hostname: echo.ornek.com
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 5678
selector:
app: echo
Uygulayın:


kubectl apply -f echo.yaml
  • DNS is updated automatically again.

Frequently Asked Questions

1. Does ExternalDNS delete DNS records? It only manages the ones it creates.

2. Why do TXT records exist? Tracks record ownership.

3. Is Ingress or Service better? Ingress is more flexible and widespread.

4. Can there be more than one domain? Yes, it can be limited with domainFilters.


Result

With ExternalDNS:

  • DNS management becomes automatic
  • Kubernetes becomes the hub
  • Risk of error is reduced
  • Distributions are accelerated

You can safely use this structure in the GenixNode Kubernetes infrastructure.