Managed DNS records for Kubernetes services#

Your Kubernetes cluster comes with ExternalDNS, which allows for managing DNS records through simple annotations on an Ingress resource.

ExternalDNS runs in a Pod and talks directly to the cloud provider so that any zone that is delegated to your cloud’s DNS service can have its records managed through Ingress resources.

Example#

In this example, a Pod runs and exposes an application on port 8080 through a Service named my-app-service. Below is what the Ingress resource might look like for this application. Note the external-dns.alpha.kubernetes.io/hostname annotation. It is what ExternalDNS looks for in its control loops.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    external-dns.alpha.kubernetes.io/hostname: my-app.my-domain.com
spec:
  rules:
  - host: my-app.my-domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: my-app-service
          servicePort: 8080

Troubleshooting#

You can view the ExternalDNS logs by running the following command:

$ kubectl logs deployments/external-dns -n rackspace-system