Guides / Networking

Manage DNS records

Names inside a VPC come from a DNSService. It runs an authoritative DNS server for one zone in one VPC, and it also decides how names outside the zone are resolved. Members get their names without any work from you. You add the other records.

Define the zone and its records

apiVersion: network.etorm.com/v1alpha1
kind: DNSService
metadata: {name: dns}
spec:
  vpcRef: {name: lan}
  zone: corp.test              # default: <vpc>.<project>.etorm.internal
  records:
    - {name: "@",     type: TXT,   value: "owner=acme"}
    - {name: www,     type: CNAME, value: web.corp.test}
    - {name: web,     type: AAAA,  value: "fd12:3456:789a:1::50", ttl: 300}
    - {name: legacy,  type: A,     value: 10.0.0.60}
FieldMeaning
records[].namerelative to the zone; @ is the apex
records[].typeA, AAAA, CNAME or TXT
registerAccountsdefault true: <account>.<zone> and gateway.<zone> are added for you
forwarders[]public IPv4 resolvers for names outside the zone; without any, outside names are refused

Change a record

Edit the file and apply it again. The controller renders the complete configuration again from the current spec, so there is no separate step to add or remove one record. In the console, open DNSService in the explorer and edit it in the wizard.

kubectl ... apply -f dns.yaml
kubectl ... get dnsservice dns -o jsonpath='{.status.phase}'

Test from a member

The server answers on the VPC's service address in the prefix, and on the first host address of the IPv4 network if the VPC has one.

dig @<prefix>::1 laptop.corp.test AAAA
dig @10.0.0.1  laptop.corp.test A      # when the VPC has IPv4
dig @<prefix>::1 example.com            # forwarded, or REFUSED without forwarders

What the DNS service does not do

Clean up

kubectl ... delete dnsservice dns

Next

Find out why something stays Pending.