DNS records are not created for ingress resources

4/10/2019

My config:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: external-dns
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: external-dns
rules:
- apiGroups: [""]
  resources: ["services"]
  verbs: ["get","watch","list"]
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get","watch","list"]
- apiGroups: ["extensions"] 
  resources: ["ingresses"] 
  verbs: ["get","watch","list"]
- apiGroups: [""]
  resources: ["nodes"]
  verbs: ["list"]
- apiGroups: ["networking.istio.io"]
  resources: ["gateways"]
  verbs: ["get","watch","list"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: external-dns-viewer
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: external-dns
subjects:
- kind: ServiceAccount
  name: external-dns
  namespace: kube-system
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: external-dns
  namespace: kube-system
spec:
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: external-dns
    spec:
      serviceAccountName: external-dns
      containers:
      - name: external-dns
        image: registry.opensource.zalan.do/teapot/external-dns:latest
        args:
        - --source=ingress
        - --source=istio-gateway
        - --domain-filter=xxx
        - --policy=upsert-only
        - --provider=azure
        volumeMounts:
        - name: azure-config-file
          mountPath: /etc/kubernetes
          readOnly: true
      volumes:
      - name: azure-config-file
        secret:
          secretName: azuredns-config

Istio gateway objects are being parsed and DNS records are being created (this happened a while back, I dont see anything in the log right now). Ingress records are not being parsed, for some reason. I've tried adding --source=service and annotating service with: external-dns.alpha.kubernetes.io/hostname: my.host.name, no effect either.

Any ideas? This looks fine, but somehow doesn't work. Ingress works, cert-manager creates cert, if I manually create DNS record ingress works fine.

-- 4c74356b41
azure
azure-aks
azure-kubernetes
kubernetes

2 Answers

4/10/2019

the issue was due to nginx-ingress not publishing its ip address to ingress resources status field. GH issue: https://github.com/kubernetes-incubator/external-dns/issues/456

--log-level=debug

helped to identify the issue. Fixed by adding this to nginx ingress controller deployment:

- --publish-service=kube-system/nginx-ingress-controller
- --update-status
-- 4c74356b41
Source: StackOverflow

4/10/2019

I suggest running https://github.com/kubernetes-incubator/external-dns with appropriate cloud provider role, e.g. IAM role in AWS which allows modifying Route53 records.

For Azure: https://github.com/kubernetes-incubator/external-dns/blob/master/docs/tutorials/azure.md

When you run it, make sure you have ingress source enabled: https://github.com/helm/charts/blob/master/stable/external-dns/values.yaml#L8-L12

It has debug logging so you can check precisely what happens to your record.

-- Max Lobur
Source: StackOverflow