Skip to content

[agw-cuj-arun-egress-vpc] - missing IAM grants for Agent Gateway service agent #2397

Open

Description

@kaysalawu

Codelab: Agent Gateway egress from Agent Runtime to VPC network

Thanks for this awesome lab!

Context: fresh project, first time using Agent Gateway, Agent Registry and Agent Runtime. None of these APIs or roles had been enabled or granted before the codelab. Once granted, the roles persist (step 14 does not remove them), so a second run in the same project does not show these errors.

5. Gateway - import fails

gcloud network-services agent-gateways import fails with Config validation failed. The Agent Gateway service agent cannot read the VPC network, the PSC network attachment or the Cloud DNS zones. Single project, steps run as written.

does not have permission to read target network ... grant it roles/compute.networkViewer
does not have permission to read network attachment ... (compute.networkAttachments.get)
does not have permission to list Cloud DNS managed zones ... grant roles/dns.reader in the project

Fix: add to the end of step 4, so IAM propagates before step 5.

# grant compute network viewer to agent gateway service agent
gcloud projects add-iam-policy-binding ${PROJ_ID} \
  --member="serviceAccount:service-${PROJ_NO}@gcp-sa-agentgateway.iam.gserviceaccount.com" \
  --role="roles/compute.networkViewer" \
  --condition=None

# grant dns reader to agent gateway service agent
gcloud projects add-iam-policy-binding ${PROJ_ID} \
  --member="serviceAccount:service-${PROJ_NO}@gcp-sa-agentgateway.iam.gserviceaccount.com" \
  --role="roles/dns.reader" \
  --condition=None

3. Setup - API batch fails

iamconnectors.googleapis.com is not available to projects outside its allowlist. With it included, the whole part 1 batch fails and the other APIs in it (agentregistry, aiplatform, networkservices and others) are not enabled.

Service iamconnectors.googleapis.com is not available to this consumer.

Fix: remove iamconnectors.googleapis.com from part 1 and re-run. The rest of part 1 then enables. No later step uses it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions