Adding a Cloudflare DNS credential

Create an API token in Cloudflare, and then add it as a DNS credential in Cloudera Cloud Factory.

  • 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.
  • You have an active Cloudflare zone and permission to create API tokens for it.
  1. In the Cloudflare dashboard, go to My Profile > API Tokens and click Create Token.
  2. Create a custom token with the following permissions, and limit the token to your zone:
    • Zone > Zone > Read
    • Zone > DNS > Edit
  3. Copy the token. In the zone Overview page, copy the zone ID from the right-hand column.
  4. In Cloudera Cloud Factory, expand Credentials in the left navigation pane, click DNS Credentials, and then click Add Credentials.
  5. Select the Organization, and make sure that Provider is set to Cloudflare, which is the default.
  6. Enter the following values:
    Table 1. Cloudflare credential values
    FieldWhat to enter
    DNS Credentials NameA name of 3 to 30 characters. Use letters, digits, and dashes.
    DomainExactly the Cloudflare zone name, for example example.com. A subdomain fails the check. Project host names become <project>.<domain>.
    API TokenThe token that you created in Cloudflare.
    Zone IDThe ID of the zone. The form requires it, and Cloudera Cloud Factory uses it only for the check when you save.

    The following screenshot shows the Add DNS Credentials drawer with the Cloudflare provider. The values shown are examples.

    Figure 1. Add DNS Credentials drawer with the Cloudflare provider

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

The credential appears on the DNS Credentials page. When you enable DNS on a project with this credential, Cloudera Cloud Factory sets up the following on the project cluster:

  • external-dns runs as the deployment external-dns-primary in the ccf-external-dns namespace. It uses the provider cloudflare, the option --domain-filter=<credential domain>, and the option --policy=sync. The token is stored in the secret external-dns-primary-creds (key api-token) and reaches the pod as the CF_API_TOKEN environment variable. The records that external-dns creates are DNS-only, not proxied.
  • With a Let's Encrypt profile, cert-manager uses the cloudflare DNS-01 solver with the same token. The token is stored in the secret cloudflare-api-token-secret in the ccf-cert-manager namespace, and the cluster issuer is ccf-default.

To change the token later, delete the credential and add it again. Then enable DNS on a project and continue with the certificate and trust profile. For the order of these steps, see Requirements and setup order.

To check that external-dns works, run the following commands:

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

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