This tutorial demonstrates how to configure a CoreWeave Kubernetes Service (CKS) cluster to authenticate to Google Cloud Storage (GCS) using OIDC Workload Identity Federation. A Kubernetes ServiceAccount in CKS will be able to access GCS directly, without any stored credentials.Documentation Index
Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
CKS issues OIDC-compliant ServiceAccount tokens to pods. These tokens can be used to authenticate to external services like Google Cloud Platform (GCP) by establishing OIDC trust. This eliminates the need for long-lived credentials and allows per-ServiceAccount scoping of access to cloud resources. Benefits of this approach:- No credentials are stored in secrets or container images.
- Tokens are short-lived and rotated automatically by Kubernetes.
- IAM permissions can be tightly scoped to individual ServiceAccounts.
- No TLS thumbprint management is required, as with AWS.
- Pod requests access: The
gcs-clientpod uses its mounted OIDC token - GCP validates identity: Google Cloud verifies the token against your CKS cluster’s OIDC endpoint
- Impersonation granted: GCP allows the pod to impersonate the
gcs-readerservice account - Resource access: The pod can read from your GCS bucket using temporary credentials
Prerequisites
Before you begin, ensure you have the following:CoreWeave requirements
- CKS cluster: A CoreWeave Kubernetes Service cluster with OIDC Workload Identity enabled
- Cluster access:
kubectlconfigured to access your CKS cluster - Cluster details: Your cluster’s OIDC issuer URL (we’ll show you how to find this)
Google Cloud Platform requirements
- GCP project: A Google Cloud Platform project where you’ll configure Workload Identity
- GCP permissions: Your GCP account must have the following IAM roles:
Workload Identity Pool Admin(to create pools and providers)Service Account Admin(to create and manage service accounts)Project IAM Admin(to bind service accounts to workload identities)
- GCS bucket: A Google Cloud Storage bucket for testing (or permission to create one)
Command line tools
- gcloud CLI: Google Cloud SDK installed and authenticated
- kubectl: Kubernetes command line tool configured for your CKS cluster
GCP project information
You’ll need these values during the tutorial. Gather them beforehand:- Project ID: Your GCP project ID (for example,
my-project-123) - Project Number: Your GCP project number (numeric, for example,
123456789012)
Verify your setup
Test that everything is configured correctly:Set up Kubernetes resources
Before configuring GCP, you need to create the Kubernetes namespace and ServiceAccount that will be granted access to GCS.Create the namespace
Create a namespace calledfoo where your workloads will run:
Create the ServiceAccount
Create a ServiceAccount calledbar that your pods will use:
Verify the resources
Confirm both resources were created successfully:- Namespace
fooinActivestatus - ServiceAccount
barexists in thefoonamespace - ServiceAccount has default token secrets (these will be replaced with projected OIDC tokens)
Understanding the mapping
These Kubernetes resources will map to GCP identities as follows:- Namespace:
foo→ GCP attributeattribute.k8s_ns=foo - ServiceAccount:
bar→ GCP attributeattribute.k8s_sa=bar
foo/bar) to ensure only pods running with this ServiceAccount in this namespace can access your GCS resources.
Get your OIDC issuer URL from CKS
To use identity federation, you must know the OIDC Issuer URL of your CKS cluster. This is the base URL from which token metadata and keys are served. It’s formatted as a valid HTTPS URL, such as:https://oidc.cks.coreweave.com/id/<CLUSTER_ID>.
There are a few ways to obtain it:
- CKS Console
- CKS API
- Terraform
- In the Cloud Console, navigate to the Clusters page.
- Click the name of the cluster to expand the cluster details panel.
- The OIDC Issuer URL is displayed in the Overview section.
Create a workload identity pool in GCP
-
Create a pool to represent trusted external identities (your CKS pods):
-
Confirm the pool was created successfully:
Expected output should show:
state: ACTIVEname: projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/k8s-pool
Workload Identity Pool Adminrole and are authenticated to the correct GCP project.
Create an OIDC provider in the pool
This setup allows GCP to map Kubernetes tokens to identities based on their namespace and ServiceAccount name:-
Configure the provider to trust your CKS OIDC issuer and extract identity information from tokens. Replace
<REGION>and<CLUSTER_ID>with your actual values. -
Check that the provider was configured correctly:
Expected output should include:
state: ACTIVE- Your CKS OIDC issuer URL in the
issuerUrifield - The attribute mapping you configured
Create a Google Cloud Service Account (GSA) and grant access
-
Create the service account that will be impersonated by CKS workloads:
-
Grant it permission to read from GCS. Replace
<PROJECT_ID>with your actual project ID.
Bind the CKS service account to the GSA
-
Authorize the Kubernetes ServiceAccount
barin namespacefooto impersonate the GSA via the identity pool. Replace<PROJECT_NUMBER>and<PROJECT_ID>with your actual values. -
Check that the binding was created correctly. Replace
<PROJECT_ID>with your actual project ID.Expected output should include a binding with:role: roles/iam.workloadIdentityUsermemberscontaining yourprincipalSet://iam.googleapis.com/projects/...entry
foo/bar ServiceAccount will be permitted to impersonate the gcs-reader account.
Prepare a test GCS bucket
Before testing the authentication, create a GCS bucket or use an existing one:- Create new test bucket
- Use existing bucket
- Bucket names must be globally unique - try adding a timestamp or random suffix.
- Ensure you have
Storage Adminpermissions in your GCP project.
Use projected OIDC token in pod and access GCS
In your workload, configure a projected service account token with the proper audience. Create a pod YAML file calledgcs-client-pod.yaml with the following content, filling in the placeholder values for [PROJECT-NUMBER], [PROJECT-ID], and [YOUR-BUCKET-NAME].
gcs-client-pod.yaml
Deploy and test the pod
-
Apply the pod configuration:
-
Wait for the pod to start and check its status:
Error 403: Permission denied: Check that thegcs-readerservice account has access to your bucket.Invalid token: Verify your OIDC issuer URL matches your cluster’s actual endpoint.- Pod won’t start: Ensure the
barServiceAccount exists in thefoonamespace.