Skip to content
This repository was archived by the owner on Jun 19, 2022. It is now read-only.

Commit f29b055

Browse files
authored
Update installation docs to include additional roles needed in WI (#1457)
* update docs * comments * comments * update invalid link * comment * comments * comments
1 parent a5859d2 commit f29b055

File tree

15 files changed

+76
-61
lines changed

15 files changed

+76
-61
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Follow this guide to install Knative-GCP components on a platform of your
1616
choice.
1717

1818
1. [Installing Knative-GCP](./docs/install/install-knative-gcp.md)
19-
1. [Installing Pub/Sub Enabled Service Account](./docs/install/pubsub-service-account.md)
19+
1. [Installing a Service Account for the Data Plane](./docs/install/dataplane-service-account.md)
2020
1. [Installing GCP Broker](./docs/install/install-gcp-broker.md)
2121
1. [Installing Broker with PubSub Channel](./docs/install/install-broker-with-pubsub-channel.md)
2222
1. [Managing Multiple Projects](./docs/install/managing-multiple-projects.md)

docs/examples/channel/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ intended to provide a durable messaging solution.
1111
install [Eventing](https://knative.dev/docs/eventing/) as part of the
1212
installation procedure.
1313

14-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
14+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
1515

1616
## Deployment
1717

@@ -21,7 +21,7 @@ intended to provide a durable messaging solution.
2121
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
2222
update `serviceAccountName` with the Kubernetes service account you
2323
created in
24-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
24+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
2525
which is bound to the Pub/Sub enabled Google service account.
2626

2727
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/cloudauditlogssource/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ directly publish to the underlying transport (Pub/Sub), in CloudEvents format.
1010

1111
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
1212

13-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
13+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
1414

1515
1. Enable the `Cloud Audit Logs API` on your project:
1616

@@ -39,7 +39,7 @@ directly publish to the underlying transport (Pub/Sub), in CloudEvents format.
3939
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
4040
update `serviceAccountName` with the Kubernetes service account you
4141
created in
42-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
42+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
4343
which is bound to the Pub/Sub enabled Google service account.
4444

4545
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/cloudbuildsource/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ build completes.
1111

1212
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
1313

14-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
14+
1. [Create a Service Account for Data Plane](../../install/dataplane-service-account.md)
1515

1616
1. Enable the `Cloud Build API` and `Cloud Pub/Sub API`, on your project:
1717

@@ -33,7 +33,7 @@ build completes.
3333
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
3434
update `serviceAccountName` with the Kubernetes service account you
3535
created in
36-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
36+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
3737
which is bound to the Pub/Sub enabled Google service account.
3838

3939
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/cloudpubsubsource/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ events using a Push-compatible format.
1111

1212
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
1313

14-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
14+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
1515

1616
## Deployment
1717

@@ -23,7 +23,7 @@ events using a Push-compatible format.
2323
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
2424
update `serviceAccountName` with the Kubernetes service account you
2525
created in
26-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
26+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
2727
which is bound to the Pub/Sub enabled Google service account.
2828

2929
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/cloudschedulersource/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ scheduled events from
2121
gcloud app create --region=$APP_ENGINE_LOCATION
2222
```
2323

24-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
24+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
2525

2626
1. Enable the `Cloud Scheduler API` on your project:
2727

@@ -37,7 +37,7 @@ scheduled events from
3737
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
3838
update `serviceAccountName` with the Kubernetes service account you
3939
created in
40-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
40+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
4141
which is bound to the Pub/Sub enabled Google service account.
4242

4343
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/cloudstoragesource/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Object Notifications for when a new object is added to Google Cloud Storage
1010

1111
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
1212

13-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
13+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
1414

1515
1. Enable the `Cloud Storage API` on your project and give Google Cloud Storage
1616
permissions to publish to GCP Pub/Sub. Currently, we support two methods:
@@ -54,7 +54,7 @@ Object Notifications for when a new object is added to Google Cloud Storage
5454
```
5555
- Option 2: Use `curl` to fetch the email:
5656
```shell
57-
export GCS_SERVICE_ACCOUNT=`curl -s -X GET -H "Authorization: Bearer \`GOOGLE_APPLICATION_CREDENTIALS=./cre-pubsub.json \
57+
export GCS_SERVICE_ACCOUNT=`curl -s -X GET -H "Authorization: Bearer \`GOOGLE_APPLICATION_CREDENTIALS=./cre-dataplane.json \
5858
gcloud auth application-default print-access-token\`" \
5959
"https://www.googleapis.com/storage/v1/projects/$PROJECT_ID/serviceAccount" \
6060
| grep email_address | cut -d '"' -f 4`
@@ -84,7 +84,7 @@ Object Notifications for when a new object is added to Google Cloud Storage
8484
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
8585
update `serviceAccountName` with the Kubernetes service account you
8686
created in
87-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
87+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
8888
which is bound to the Pub/Sub enabled Google service account.
8989
9090
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/keda/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ the `CloudPubSubSource` scalable. Note that you could do this for any of the
4848

4949
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
5050

51-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
51+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
5252

5353
1. Given that KEDA queries StackDriver for metrics, give the Service Account
5454
created in the previous step permissions to do so.
5555

5656
```shell
5757
gcloud projects add-iam-policy-binding $PROJECT_ID \
58-
--member=serviceAccount:cre-pubsub@$PROJECT_ID.iam.gserviceaccount.com \
58+
--member=serviceAccount:cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com \
5959
--role roles/monitoring.viewer
6060
```
6161

docs/examples/pullsubscription/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ does so using a Pull format.
1313

1414
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
1515

16-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
16+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
1717

1818
## Deployment
1919

@@ -31,7 +31,7 @@ does so using a Pull format.
3131
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
3232
update `serviceAccountName` with the Kubernetes service account you
3333
created in
34-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
34+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
3535
which is bound to the Pub/Sub enabled Google service account.
3636

3737
1. If you are using standard Kubernetes secrets, but want to use a

docs/examples/topic/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ construct used by higher-level objects, such as `Channel`.
1010

1111
1. [Install Knative-GCP](../../install/install-knative-gcp.md)
1212

13-
1. [Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md)
13+
1. [Create a Service Account for the Data Plane](../../install/dataplane-service-account.md)
1414

1515
## Deployment
1616

@@ -27,7 +27,7 @@ construct used by higher-level objects, such as `Channel`.
2727
[Workload Identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity),
2828
update `serviceAccountName` with the Kubernetes service account you
2929
created in
30-
[Create a Pub/Sub enabled Service Account](../../install/pubsub-service-account.md),
30+
[Create a Service Account for the Data Plane](../../install/dataplane-service-account.md),
3131
which is bound to the Pub/Sub enabled Google service account.
3232

3333
1. If you are using standard Kubernetes secrets, but want to use a

docs/install/authentication-mechanisms-gcp.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ gcloud projects add-iam-policy-binding $PROJECT_ID \
140140
## Authentication Mechanism for the Data Plane
141141
142142
Please check
143-
[Installing Pub/Sub Enabled Service Account](../install/pubsub-service-account.md).
143+
[Installing a Service Account for the Data Plane](../install/dataplane-service-account.md).
144144
145145
## Troubleshooting
146146
@@ -428,13 +428,13 @@ kubectl get secret -n namespace
428428
***
429429
**_To solve this issue_**, you can:
430430
431-
* Check the Google Cloud Service Account `cre-pubsub` for the Data Plane has
431+
* Check the Google Cloud Service Account `cre-dataplane` for the Data Plane has
432432
all required permissions.
433433
* Check authentication configuration is correct for this resource instance.
434434
435435
- If you are using Workload Identity for this resource instance, refer
436436
[here](./authentication-mechanisms-gcp.md/#workload-identity) to check
437-
the Google Cloud Service Account `cre-pubsub`, and the Kubernetes
437+
the Google Cloud Service Account `cre-dataplane`, and the Kubernetes
438438
Service Account in the namespace where this resource instance resides.
439439
- If you are using Kubernetes Secrets for this resource instance, refer
440440
[here](./authentication-mechanisms-gcp.md/#kubernetes-secrets) to check
@@ -465,13 +465,13 @@ kubectl get secret -n namespace
465465
type: Ready
466466
status: "False"
467467
message: 'rpc error: code = PermissionDenied desc = Permission iam.serviceAccounts.setIamPolicy
468-
is required to perform this operation on service account projects/-/serviceAccounts/cre-pubsub@PROJECT_ID.iam.gserviceaccount.com.'
468+
is required to perform this operation on service account projects/-/serviceAccounts/cre-dataplane@PROJECT_ID.iam.gserviceaccount.com.'
469469
reason: WorkloadIdentityFailed
470470
```
471471
it is most likely that you didn't grant `iam.serviceAccountAdmin`
472472
permission of the Google Cloud Service Account to the Control Plane's
473473
Google Cloud Service Account `cloud-run-events`, refer to
474-
[default scenario](../install/pubsub-service-account.md/#option-1-use-workload-identity)
474+
[default scenario](../install/dataplane-service-account.md/#option-1-use-workload-identity)
475475
to grant permission.
476476
- If the `Condition` `Ready` has concurrency related error message like
477477
this:
@@ -484,5 +484,5 @@ kubectl get secret -n namespace
484484
```
485485
the controller will retry it in the next reconciliation loop (the maximum
486486
retry period is 5 min). You can also use
487-
[non-default scenario](../install/pubsub-service-account.md/#option-1-use-workload-identity)
487+
[non-default scenario](../install/dataplane-service-account.md/#option-1-use-workload-identity)
488488
if this error lasts for a long time.

docs/install/pubsub-service-account.md renamed to docs/install/dataplane-service-account.md

+35-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Installing Pub/Sub Enabled Service Account
1+
# Installing a Service Account for the Data Plane
22

33
Besides the control plane setup described in the general
44
[installation guide](./install-knative-gcp.md), each of our resources have a
@@ -28,10 +28,10 @@ In general, we would just need permissions to receive messages
2828
(`roles/pubsub.subscriber`). However, in the case of the `Channel`, we would
2929
also need the ability to publish messages (`roles/pubsub.publisher`).
3030

31-
1. Create a new Service Account named `cre-pubsub` with the following command:
31+
1. Create a new Service Account named `cre-dataplane` with the following command:
3232

3333
```shell
34-
gcloud iam service-accounts create cre-pubsub
34+
gcloud iam service-accounts create cre-dataplane
3535
```
3636

3737
1. Give that Service Account the necessary permissions on your project.
@@ -43,9 +43,24 @@ also need the ability to publish messages (`roles/pubsub.publisher`).
4343

4444
```shell
4545
gcloud projects add-iam-policy-binding $PROJECT_ID \
46-
--member=serviceAccount:cre-pubsub@$PROJECT_ID.iam.gserviceaccount.com \
46+
--member=serviceAccount:cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com \
4747
--role roles/pubsub.editor
4848
```
49+
50+
***Note:***
51+
If you are going to use metrics and tracing to track your resources,
52+
you also need `roles/monitoring.metricWriter` for metrics functionality:
53+
```shell
54+
gcloud projects add-iam-policy-binding $PROJECT_ID \
55+
--member=serviceAccount:cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com \
56+
--role roles/monitoring.metricWriter
57+
```
58+
and `roles/cloudtrace.agent` for tracing functionality:
59+
```shell
60+
gcloud projects add-iam-policy-binding $PROJECT_ID \
61+
--member=serviceAccount:cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com \
62+
--role roles/cloudtrace.agent
63+
```
4964

5065
## Configure the Authentication Mechanism for GCP (the Data Plane)
5166

@@ -71,7 +86,7 @@ Plane:
7186

7287
- **_Non-default scenario:_**
7388

74-
Using the Google Cloud Service Account `cre-pubsub` you just created and using
89+
Using the Google Cloud Service Account `cre-dataplane` you just created and using
7590
[Option 1 (Recommended): Workload Identity](../install/authentication-mechanisms-gcp.md/#option-1-recommended-workload-identity)
7691
in
7792
[Authentication Mechanism for GCP](../install/authentication-mechanisms-gcp.md)
@@ -82,7 +97,7 @@ Plane:
8297
configuration in the Control Plane)
8398

8499
You will have a Kubernetes Service Account after the above configuration,
85-
which is bound to the Google Cloud Service Account `cre-pubsub`. Remember to
100+
which is bound to the Google Cloud Service Account `cre-dataplane`. Remember to
86101
put this Kubernetes Service Account name as the `spec.serviceAccountName` when
87102
you create resources in the
88103
[example](https://github.com/google/knative-gcp/tree/master/docs/examples).
@@ -94,12 +109,12 @@ Plane:
94109
you can authorize the Controller to configure Workload Identity for you.
95110

96111
You need to grant `iam.serviceAccountAdmin` permission of the Google Cloud
97-
Service Account `cre-pubsub` you just created to the Control Plane's Google
112+
Service Account `cre-dataplane` you just created to the Control Plane's Google
98113
Cloud Service Account `cloud-run-events` by:
99114
100115
```shell
101116
gcloud iam service-accounts add-iam-policy-binding \
102-
cre-pubsub@$PROJECT_ID.iam.gserviceaccount.com \
117+
cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com \
103118
--member='serviceAccount:cloud-run-events@$PROJECT_ID.iam.gserviceaccount.com' \
104119
--role='roles/iam.serviceAccountAdmin'
105120
```
@@ -118,22 +133,22 @@ Plane:
118133
default-auth-config: |
119134
clusterDefaults:
120135
workloadIdentityMapping:
121-
default-cre-pubsub: cre-pubsub@$PROJECT_ID.iam.gserviceaccount.com
136+
default-cre-dataplane: cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com
122137
```
123138
124-
Here, `default-cre-pubsub` refers to a Kubernetes Service Account bound to the
125-
Google Cloud Service Account `cre-pubsub`. Remember to put this Kubernetes
139+
Here, `default-cre-dataplane` refers to a Kubernetes Service Account bound to the
140+
Google Cloud Service Account `cre-dataplane`. Remember to put this Kubernetes
126141
Service Account name as the `spec.serviceAccountName` when you create
127142
resources in the
128143
[example](https://github.com/google/knative-gcp/tree/master/docs/examples).
129144
130-
Kubernetes Service Account `default-cre-pubsub` doesn't need to exist in a
145+
Kubernetes Service Account `default-cre-dataplane` doesn't need to exist in a
131146
specific namespace. Once it is set in the ConfigMap `config-gcp-auth`, the
132147
Control Plane will create it for you and configure the corresponding Workload
133148
Identity relationship between the Kubernetes Service Account
134-
`default-cre-pubsub` and the Google Cloud Service Account `cre-pubsub` when
149+
`default-cre-dataplane` and the Google Cloud Service Account `cre-dataplane` when
135150
you create resources using the Kubernetes Service Account
136-
`default-cre-pubsub`.
151+
`default-cre-dataplane`.
137152

138153
A `Condition` `WorkloadIdentityConfigured` will show up under resources'
139154
`Status`, indicating the Workload Identity configuration status.
@@ -142,26 +157,26 @@ as a result, any user who can create a resource can get access to the Google Clo
142157
Service Account which grants the `iam.serviceAccountAdmin` permission to the Controller.
143158
As an example, if you followed the instructions above, then any user that can make
144159
a Knative-GCP source or Channel (e.g. `CloudAuditLogsSource`, `CloudPubSubSource`,
145-
etc.) can cause the Kubernetes Service Account `default-cre-pubsub` to be created.
160+
etc.) can cause the Kubernetes Service Account `default-cre-dataplane` to be created.
146161
If they can also create Pods in that namespace, then they can make a Pod that uses
147-
the Google Service Account `cre-pubsub` credentials.
162+
the Google Service Account `cre-dataplane` credentials.
148163
149164
### Option 2. Export Service Account Keys And Store Them as Kubernetes Secrets
150165
151166
1. Download a new JSON private key for that Service Account. **Be sure not to
152167
check this key into source control!**
153168
154169
```shell
155-
gcloud iam service-accounts keys create cre-pubsub.json \
156-
--iam-account=cre-pubsub@$PROJECT_ID.iam.gserviceaccount.com
170+
gcloud iam service-accounts keys create cre-dataplane.json \
171+
--iam-account=cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com
157172
```
158173
159174
1. Create a secret on the Kubernetes cluster with the downloaded key. Remember
160175
to create the secret in the namespace your resources will reside. The example
161176
below does so in the `default` namespace.
162177
163178
```shell
164-
kubectl --namespace default create secret generic google-cloud-key --from-file=key.json=cre-pubsub.json
179+
kubectl --namespace default create secret generic google-cloud-key --from-file=key.json=cre-dataplane.json
165180
```
166181
167182
`google-cloud-key` and `key.json` are default values expected by our
@@ -178,5 +193,5 @@ the Google Service Account `cre-pubsub` credentials.
178193
1. Delete the service account
179194
180195
```shell
181-
gcloud iam service-accounts delete cre-pubsub@$PROJECT_ID.iam.gserviceaccount.com
196+
gcloud iam service-accounts delete cre-dataplane@$PROJECT_ID.iam.gserviceaccount.com
182197
```

0 commit comments

Comments
 (0)