# Configuring Knative and CertManager for Google Cloud DNS These instructions assume you have already setup a Knative cluster and installed cert-manager into your cluster. For more information, see [using an SSL certificate](using-an-ssl-cert.md#install-cert-manager). They also assume you have already set up your managed zone with Cloud DNS as part of configuring the domain to map to your IP address. To automate the generation of a certificate with cert-manager and LetsEncrypt, we will use a `DNS01` challenge type, which requires the domain owner to add a TXT record to their zone to prove ownership. Other challenge types are not currently supported by Knative. ## Creating a Cloud DNS service account To add the TXT record, configure Knative with a service account that can be used by cert-manager to create and update the DNS record. To begin, create a new service account with the project role `dns.admin`: ```shell # Set this to your GCP project ID export PROJECT_ID= # Name of the service account you want to create. export CLOUD_DNS_SA=cert-manager-cloud-dns-admin gcloud --project $PROJECT_ID iam service-accounts \ create $CLOUD_DNS_SA \ --display-name "Service Account to support ACME DNS-01 challenge." # Fully-qualified service account name also has project-id information. export CLOUD_DNS_SA=$CLOUD_DNS_SA@$PROJECT_ID.iam.gserviceaccount.com # Bind the role dns.admin to this service account, so it can be used to support # the ACME DNS01 challenge. gcloud projects add-iam-policy-binding $PROJECT_ID \ --member serviceAccount:$CLOUD_DNS_SA \ --role roles/dns.admin # Download the secret key file for your service account. gcloud iam service-accounts keys create ~/key.json \ --iam-account=$CLOUD_DNS_SA ``` After obtaining the service account secret, publish it to your cluster. This command uses the secret name `cloud-dns-key`, but you can choose a different name. ```shell # Upload that as a secret in your Kubernetes cluster. kubectl create secret --namespace cert-manager generic cloud-dns-key \ --from-file=key.json=$HOME/key.json # Delete the local secret rm ~/key.json ``` ## Configuring CertManager to use your DNS admin service account Next, configure cert-manager to request new certificates and verify the challenges using DNS. ### Specifying a certificate issuer This example configures cert-manager to use LetsEncrypt, but you can use any certificate provider that supports the ACME protocol. This example uses the `dns01` challenge type, which will enable certificate generation and wildcard certificates. ```shell kubectl apply --filename - <