GoogleCloudPlatform / anthos-samples

Anthos code samples
https://cloud.google.com/anthos/docs
Apache License 2.0
93 stars 118 forks source link

Adding more APIs and role binding to the prerequisite #678

Closed shedyb closed 1 week ago

shedyb commented 3 months ago

While reproducing a case, I noticed that customers using this public document to create GKE on bare metal are likely to encounter errors due to some missing prerequisites..

Under the list on APIs to be enable we need to include the following :

iam.googleapis.com 
kubernetesmetadata.googleapis.com 

Also under the role bindings, we need to include the following :

gcloud projects add-iam-policy-binding PROJECT_ID \ --member="serviceAccount:baremetal-gcr@$PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/kubernetesmetadata.publisher"

gavi0231 commented 1 month ago

In addition to the prerequisite APIs and role binding identified by @shedyb, the following updates are needed to keep the sample in sync with the public bare metal documentation and to ensure the sample scripts work without errors.

Under the list of APIs to enable, add the following:

compute.googleapis.com

Under role bindings, add the following:

gcloud projects add-iam-policy-binding "$PROJECT_ID" \
  --member="serviceAccount:baremetal-gcr@$PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/monitoring.viewer" \
  --no-user-output-enabled

gcloud projects add-iam-policy-binding "$PROJECT_ID" \
  --member="serviceAccount:baremetal-gcr@$PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/serviceusage.serviceUsageViewer" \
  --no-user-output-enabled