|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * security/cert_manager_operator/cert-manager-authenticate-non-sts-gcp.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="cert-manager-prepare-cloud-credentials-gcp-non-sts_{context}"] |
| 7 | += Configuring cloud credentials for the {cert-manager-operator} on GCP |
| 8 | + |
| 9 | +To configure the cloud credentials for the {cert-manager-operator} on a GCP cluster you must create a `CredentialsRequest` object, and allow the Cloud Credential Operator to generate the cloud credentials secret. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* The {cert-manager-operator} 1.11.1 or later is installed. |
| 14 | +* You have configured the Cloud Credential Operator to operate in _mint_ or _passthrough_ mode. |
| 15 | +
|
| 16 | +.Procedure |
| 17 | + |
| 18 | +. Create a `CredentialsRequest` resource YAML file, such as, `sample-credential-request.yaml` by applying the following yaml: |
| 19 | ++ |
| 20 | +[source,yaml] |
| 21 | +---- |
| 22 | +apiVersion: cloudcredential.openshift.io/v1 |
| 23 | +kind: CredentialsRequest |
| 24 | +metadata: |
| 25 | + name: cert-manager |
| 26 | + namespace: openshift-cloud-credential-operator |
| 27 | +spec: |
| 28 | + providerSpec: |
| 29 | + apiVersion: cloudcredential.openshift.io/v1 |
| 30 | + kind: GCPProviderSpec |
| 31 | + predefinedRoles: |
| 32 | + - roles/dns.admin |
| 33 | + secretRef: |
| 34 | + name: gcp-credentials |
| 35 | + namespace: cert-manager |
| 36 | + serviceAccountNames: |
| 37 | + - cert-manager |
| 38 | +---- |
| 39 | + |
| 40 | +. Create a `CredentialsRequest` resource by running the following command: |
| 41 | ++ |
| 42 | +[source,terminal] |
| 43 | +---- |
| 44 | +$ oc create -f sample-credential-request.yaml |
| 45 | +---- |
| 46 | + |
| 47 | +. Update the subscription object for {cert-manager-operator} by running the following command: |
| 48 | ++ |
| 49 | +[source,terminal] |
| 50 | +---- |
| 51 | +$ oc -n cert-manager-operator patch subscription openshift-cert-manager-operator --type=merge -p '{"spec":{"config":{"env":[{"name":"CLOUD_CREDENTIALS_SECRET_NAME","value":"gcp-credentials"}]}}}' |
| 52 | +---- |
| 53 | + |
| 54 | +.Verification |
| 55 | + |
| 56 | +. Get the name of the redeployed cert-manager controller pod by running the following command: |
| 57 | ++ |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ oc get pods -l app.kubernetes.io/name=cert-manager -n cert-manager |
| 61 | +---- |
| 62 | ++ |
| 63 | +.Example output |
| 64 | +[source,terminal] |
| 65 | +---- |
| 66 | +NAME READY STATUS RESTARTS AGE |
| 67 | +cert-manager-bd7fbb9fc-wvbbt 1/1 Running 0 15m39s |
| 68 | +---- |
| 69 | + |
| 70 | +. Verify that the cert-manager controller pod is updated with GCP workload identity credential volumes that are mounted under the path specified in `mountPath` by running the following command: |
| 71 | ++ |
| 72 | +[source,terminal] |
| 73 | +---- |
| 74 | +$ oc get -n cert-manager pod/<cert-manager_controller_pod_name> -o yaml |
| 75 | +---- |
| 76 | ++ |
| 77 | +.Example output |
| 78 | +[source,terminal] |
| 79 | +---- |
| 80 | +spec: |
| 81 | + containers: |
| 82 | + - args: |
| 83 | + ... |
| 84 | + volumeMounts: |
| 85 | + ... |
| 86 | + - mountPath: /.config/gcloud |
| 87 | + name: cloud-credentials |
| 88 | + .... |
| 89 | + volumes: |
| 90 | + ... |
| 91 | + - name: cloud-credentials |
| 92 | + secret: |
| 93 | + ... |
| 94 | + items: |
| 95 | + - key: service_account.json |
| 96 | + path: application_default_credentials.json |
| 97 | + secretName: gcp-credentials |
| 98 | +---- |
0 commit comments