For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
GCP backend authentication
Authenticate to Google Cloud Platform (GCP) backends from the gateway using GCP authentication.
Configure authentication for backends in Google Cloud Platform (GCP) with an AgentgatewayPolicy.
By default, the proxy uses ambient credentials from the cluster provider environment, such as Workload Identity on GKE, or the GOOGLE_APPLICATION_CREDENTIALS environment variable set to a service account key file. To use token-based credentials, apply an AgentgatewayPolicy with GCP auth to your backend.
Before you begin
Before you begin
- Set up an agentgateway proxy.
- Install the httpbin sample app.
Configure GCP backend authentication
Create an AgentgatewayPolicy that uses GCP authentication to sign requests to your backend.
For access token authentication (used for most GCP services):
kubectl apply -f- <<EOF
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: gcp-backend-auth
namespace: agentgateway-system
spec:
targetRefs:
- group: agentgateway.dev
kind: AgentgatewayBackend
name: my-gcp-backend
backend:
auth:
gcp:
type: AccessToken
EOFFor ID token authentication (used for Cloud Run and other audience-based services):
kubectl apply -f- <<EOF
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: gcp-backend-auth
namespace: agentgateway-system
spec:
targetRefs:
- group: agentgateway.dev
kind: AgentgatewayBackend
name: my-gcp-backend
backend:
auth:
gcp:
type: IdToken
audience: "https://my-cloudrun-service-xyz.run.app"
EOF| Field | Description |
|---|---|
backend.auth.gcp.type | The type of token to generate. AccessToken is used for most GCP services; IdToken is used for Cloud Run. |
backend.auth.gcp.audience | Explicit aud claim for the ID token. Only valid with IdToken type. Derived from the backend hostname when omitted. |
Cleanup
kubectl delete AgentgatewayPolicy gcp-backend-auth -n agentgateway-system