Skip to main content

Onboard an Ingress

Introduction

Advertising ingresses to your DNS provider with ExternalDNS is as easy as adding an annotation for the hostname you want to assign. This document describes exposing an ingress to ExternalDNS.

Create an Annotation

Create a YAML configuration filed using the following template, which has annotations added under metadata to begin advertising the ingress with ExternalDNS.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: minimal-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
external-dns.alpha.kubernetes.io/hostname: subdomain.domain.tld # Required
external-dns.alpha.kubernetes.io/ttl: "120" # Optional: In Seconds
spec:
ingressClassName: nginx-example
rules:
- http:
paths:
- path: /testpath
pathType: Prefix
backend:
service:
name: test
port:
number: 80

Add Annotations in a Deployed Ingress YAML File

If you already have an ingress deployed on your cluster, then use the following command to edit the YAML file.

kubectl edit ingress <ingress-file-name>

In the YAML file, under metadata, add the following annotations:

metadata:
name: <already existing ingress name>
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
external-dns.alpha.kubernetes.io/hostname: subdomain.domain.tld # Required
external-dns.alpha.kubernetes.io/ttl: "120" # Optional: In Seconds

Verify the Record Creation

As ExternalDNS checks for record changes to be created, updated, or deleted every 60 seconds, give a minute or two for your changes to propagate. You can also view the logs of the external-dns pod to see your DNS records change in real time.

After sufficient time has passed, either check the user interface of the DNS provider or use dig, nslookup, or another similar DNS lookup tool to confirm changes are published.