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.

Fast Forward

If you have exposed EKF, it means you have already created a Cloud DNS managed zone. We recommend that you use the managed zone you have already created. In this case, proceed to the What’s Next section.

If you wish to create a new hosted zone for your desired domain, proceed with following this guide.

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 SERVING_DOMAIN=<DOMAIN>

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

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

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

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

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

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

    root@rok-tools:~# gcloud dns managed-zones describe ${SERVING_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 SERVING_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=${SERVING_DOMAIN?}. NAME DNS_NAME DESCRIPTION VISIBILITY gcp-serving serving.example.com. DNS zone for Serving. public
  2. Describe the zone and inspect the nameServers field:

    root@rok-tools:~# gcloud dns managed-zones describe ${SERVING_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 ${SERVING_DOMAIN?} serving.example.com name server ns-cloud-d2.googledomains.com. serving.example.com name server ns-cloud-d4.googledomains.com. serving.example.com name server ns-cloud-d3.googledomains.com. serving.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.