External-dns: DNS records do not appear to be deleted after ingress is deleted

Created on 18 Jan 2018  路  4Comments  路  Source: kubernetes-sigs/external-dns

When I create a simple deployment the DNS record for it is created as expected. But when I delete the deployment, the DNS record is not deleted.

kubectl create -f helloworld.yml

Records are created.

kubectl delete -f helloworld.yml

Records are NOT deleted.

# helloworld.yml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: helloworld
spec:
  template:
    metadata:
      labels:
        # Refer to this name when defining a service.
        app: helloworld
    spec:
      containers:
        # This is the docker image on your docker registry. This one is on
        # the official Docker registry.
      - image: neilhwatson/web-docker:1.0
        name: helloworld
        ports:
          -
          # Name the port so we can refer to in service router
          # TODO Test this
            name: helloworldport
            containerPort: 80

---

# Expose the container as a service to the outside via DNS record and port.
apiVersion: v1
kind: Service
metadata:
  name: helloworld
  labels:
    app: helloworld
  annotations:
    external-dns.alpha.kubernetes.io/hostname: helloworld.k8s.example.net
    #external-dns.alpha.kubernetes.io/ttl: 60
spec:
  type: NodePort
  ports:
    # Outside port mapped to deployed container port by name
  - port: 80
    targetPort: helloworldport
  selector:
    # Refer to our deployed container
    app: helloworld

---

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: helloworld
  annotations:
    kubernetes.io/ingress.class: "nginx"
    ingress.kubernetes.io/ssl-redirect: "true"
spec:
  rules:
  - host: "helloworld.k8s.example.net"
    http:
      paths:
      - path: /
        backend:
          serviceName: helloworld
          servicePort: 80

Most helpful comment

The default in that helm chart is upsert-only: https://github.com/kubernetes/charts/blob/master/stable/external-dns/values.yaml#L44-L45

To declare it at install time you could do:
helm install stable/external-dns --namespace=kube-system --name=external-dns --set policy=sync

or alternatively create an override properties file and pass it in via:
helm install stable/external-dns --namespace=kube-system --name=external-dns -f overrides.yaml

All 4 comments

Do you have the policy argument on your external-dns runtime to sync as opposed upsert-only?

If it's set to upsert-only records will be created by DNS but never deleted

I installed external-dns via helm. What is the default, and how do I declare it a install time?

helm install stable/external-dns --namespace=kube-system --name=external-dns

The default in that helm chart is upsert-only: https://github.com/kubernetes/charts/blob/master/stable/external-dns/values.yaml#L44-L45

To declare it at install time you could do:
helm install stable/external-dns --namespace=kube-system --name=external-dns --set policy=sync

or alternatively create an override properties file and pass it in via:
helm install stable/external-dns --namespace=kube-system --name=external-dns -f overrides.yaml

Works. Thank you.

Was this page helpful?
0 / 5 - 0 ratings