Adding a Google Cloud DNS credential

Add a DNS credential for a public Cloud DNS managed zone by using a service account key.

  • You completed Setting up Google Cloud for DNS credentials and have the project ID and the service account key file.
  • The DNS preview feature is turned on.
  • You have Manager group access in the organization, the Domain Owner or Domain Admin role, or the Admin role.

For the general procedure, see Adding a DNS credential. This topic covers the values for Google Cloud DNS.

  1. In the left navigation pane, expand Credentials and click DNS Credentials.
  2. Click Add Credentials.
  3. In the General section, select the Organization and enter a DNS Credentials Name and the Domain.
  4. In the Credentials Provider section, select Google Cloud DNS as the provider and Static Credentials as the authentication method.
    Do not select workload identity. It is not supported yet.

    The following screenshot shows the Authentication list with Static Credentials selected and Workload identity listed.

    Figure 1. Authentication list for a Google Cloud DNS credential

    Authentication list with Static Credentials selected and Workload identity listed
  5. In the Credentials section, enter the Google Cloud fields.
    Table 1. Values for a Google Cloud DNS credential
    FieldValue
    DNS Credentials Name3 to 30 characters: letters, digits, and dashes.
    DomainExactly the DNS name of the managed zone, without the trailing dot, for example gcpdns.example.com. A parent domain or a subdomain of the zone fails the credential check.
    ProjectThe ID, not the name, of the Google Cloud project that holds the zone.
    Service Account JSONThe whole content of the key file. It must be valid JSON and contain client_email.

    The following screenshot shows the Add DNS Credentials drawer for Google Cloud DNS. The values shown are examples.

    Figure 2. Add DNS Credentials drawer with the Google Cloud DNS provider

    Add DNS Credentials drawer with Google Cloud DNS as the provider and example values filled in
  6. Click Add credentials.
    Cloudera Cloud Factory checks the credential against Cloud DNS when you save it. A credential that fails the check is not saved.

The credential appears on the DNS Credentials page. After you save the credential, you can edit only the name and the domain. To change the key or the project, delete the credential and add it again.

When you enable DNS on a project that uses a Google Cloud DNS credential, Cloudera Cloud Factory sets up the following components on the project cluster:

  • external-dns runs as the deployment external-dns-primary in the namespace ccf-external-dns. It uses the google provider and the options --google-project=project, --domain-filter=credential-domain, and --policy=sync. The key is in the secret external-dns-primary-creds under the key credentials.json. The secret is mounted at /etc/gcp and is used through the GOOGLE_APPLICATION_CREDENTIALS environment variable.
  • external-dns marks each record that it creates with a TXT record that holds the owner ID of the project. external-dns changes or deletes only records that carry its own owner ID.
  • cert-manager, when the project uses a Let's Encrypt profile, uses the cloudDNS DNS-01 solver with the same project and key.

The domain filter is the zone of the credential, not the domain of the project. For this reason, external-dns on a project can create records anywhere in the zone. Several projects can share one credential and one zone. Their owner IDs keep their records apart.

To use Let's Encrypt with Google Cloud DNS, you do not need to change the credential. Assign a Let's Encrypt certificate and trust profile to the project, as described in Assigning a profile to a project. cert-manager then uses the cloudDNS DNS-01 solver with the same Google Cloud project and service account key as external-dns. For each certificate, cert-manager writes an _acme-challenge TXT record into the public zone and removes it after issuance. Single-name and wildcard certificates work, and Let's Encrypt requires a public zone.

To check that DNS works, run the following commands:

# Check that external-dns started without errors
kubectl --context=<project> -n ccf-external-dns logs deploy/external-dns-primary | grep -i -E 'google|error'

# List the records in the zone
gcloud dns record-sets list --zone <zone-name> --project <project-id>

# Check public resolution
dig +short <host>.<zone> @1.1.1.1

If the credential is rejected or records do not appear, see Troubleshooting Google Cloud DNS credentials.