Create Cloud DNS Managed Zone

In this section you will create a Cloud DNS managed zone for your desired domain. ExternalDNS will dynamically update the records of this zone based on the Ingress resources in your GKE cluster.

Note

If you already have a Cloud DNS managed zone for your desired domain, you may proceed to the Verify section.

If you are not going to use Cloud DNS to assign an FQDN to your Load Balancer, you can use Cloud Endpoints or edit /etc/hosts manually. You will find instructions for the aforemetioned alternatives in the guides that follow. You may proceed to the What’s Next section.

Procedure

  1. Specify the DNS name suffix (domain) for the managed zone:

    root@rok-tools:~# export DOMAIN=<DOMAIN>
    

    Replace <DOMAIN> with your desired domain. For example:

    root@rok-tools:~# export DOMAIN=apps.example.com
    
  2. Specify the name of the managed zone:

    root@rok-tools:~# export ZONE_NAME=<ZONE_NAME>
    

    Replace <ZONE_NAME> with your desired zone name. For example:

    root@rok-tools:~# export ZONE_NAME=gcp-apps
    
  3. Create a managed zone in Cloud DNS:

    root@rok-tools:~# gcloud dns managed-zones create ${ZONE_NAME?} \
    >    --dns-name=${DOMAIN?}. \
    >    --description="DNS zone for GCP apps"
    
  4. Obtain the Google Cloud nameservers for your managed zone:

    root@rok-tools:~# gcloud dns managed-zones  describe ${ZONE_NAME?} --format json | \
    >    jq -r .nameServers[]
    ns-cloud-d1.googledomains.com.
    ns-cloud-d2.googledomains.com.
    ns-cloud-d3.googledomains.com.
    ns-cloud-d4.googledomains.com.
    
  5. Update your nameservers to forward DNS queries for DOMAIN to the Google Cloud nameservers found above.

Verify

  1. Ensure that a managed zone for your desired domain exists:

    root@rok-tools:~# gcloud dns managed-zones  list --filter dnsName=${DOMAIN?}.
    NAME      DNS_NAME           DESCRIPTION                         VISIBILITY
    gcp-apps  apps.example.com.  DNS zone for GCP apps.              public
    
  2. Describe the zone and inspect the nameServers field:

    root@rok-tools:~# gcloud dns managed-zones describe ${ZONE_NAME?}
    ...
    nameServers:
    - ns-cloud-d1.googledomains.com.
    - ns-cloud-d2.googledomains.com.
    - ns-cloud-d3.googledomains.com.
    - ns-cloud-d4.googledomains.com.
    visibility: public
    
  3. Ensure that the domain is delegated to the exact same Google Cloud nameservers found above:

    root@rok-tools:~# host -t ns ${DOMAIN?}
    apps.example.com name server ns-cloud-d2.googledomains.com.
    apps.example.com name server ns-cloud-d4.googledomains.com.
    apps.example.com name server ns-cloud-d3.googledomains.com.
    apps.example.com name server ns-cloud-d1.googledomains.com.
    

Summary

You have successfully created a Cloud DNS managed zone.

What’s Next

The next step is to configure and install ExternalDNS.