Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS records do not appear to be deleted after ingress is deleted #442

Closed
neilhwatson opened this issue Jan 18, 2018 · 4 comments
Closed

Comments

@neilhwatson
Copy link

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
@Evesy
Copy link
Contributor

Evesy commented Jan 18, 2018

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

@neilhwatson
Copy link
Author

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

@Evesy
Copy link
Contributor

Evesy commented Jan 18, 2018

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

@neilhwatson
Copy link
Author

Works. Thank you.

@ideahitme ideahitme changed the title DNS records do not appear to be deleted after deployment is deleted DNS records do not appear to be deleted after ingress is deleted Jan 18, 2018
lou-lan pushed a commit to lou-lan/external-dns that referenced this issue May 11, 2022
…#442)

* Expose environment.NewPaths for integration tests

* Simplify tests by using environment.NewPaths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants