external DNS: Ignore Ingress object

1 min read | by Jordi Prats

If we are using external DNS to create DNS records based on the configured Ingress objects we might face a situation where we have two Ingress objects with the same hosts configured:

$ kubectl get ingress
NAME                    CLASS    HOSTS                                          ADDRESS       PORTS     AGE
repo-nginx              <none>   repo.pet2cattle.com                            10.12.10.21   80        194d
repo-alb                <none>   repo.pet2cattle.com                            10.12.10.31   80, 443   115d

In a situation like this, we want to be able to tell external DNS to ignore one of them.

We'll need to add the following annotation to the Ingress object that we want to ignore:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    dns.alpha.kubernetes.io/ingress-hostname-source: annotation-only
  name: repo-nginx
(...)

With this we are telling external DNS that we are going to specify a list of hosts using annotations but specifying none thus effectively making it to ignore that Ingress object


Posted on 05/07/2022