Skip to main content
This guide provides a step-by-step walkthrough for configuring Google Cloud Workload Identity Federation on a Talos Kubernetes cluster. It covers setting up the necessary GCP infrastructure (buckets, pools, providers), patching the Talos API server with the OIDC issuer, audience, and JWKS settings Google Cloud needs, and binding Kubernetes Service Accounts to Google Service Accounts for secure authentication.

Environment setup

We’ll make use of the following environment variables throughout the setup. Edit the variables below with your correct information.

Set up GCP Workload Identity infrastructure

This section sets up the bucket, pool, and OIDC provider Google Cloud needs to trust your cluster.

Create the OIDC Storage Bucket

GCP needs a way to fetch the public keys from your cluster to verify signatures. We use a public GCS bucket to host these keys.

Create the Workload Identity Pool

Create a Workload Identity Pool to manage and trust external identities for authentication.

Create the OIDC provider

Create an OIDC provider that trusts tokens from the specified issuer, enabling secure external authentication to Google Cloud.

Configure Talos for Workload Identity Federation

With the GCP side in place, the next step is configuring Talos to issue and expose the OIDC tokens Google Cloud expects.

Retrieve OIDC provider URL

First, retrieve the full resource name of the OIDC provider. This value will be used when configuring the API server audiences.

Generate a Talos patch

Next, create a patch file to configure the Talos cluster with the required OIDC settings for Google Workload Identity Federation.

Apply OIDC patch to control plane node

Retrieve every control plane node’s IP and apply the OIDC patch to configure the cluster for Workload Identity authentication.

Retrieve Kubernetes OIDC configuration

Download the cluster’s keys.json and discovery.json files, which contain the OIDC public keys and discovery metadata needed for external authentication.

Upload to GCS

Upload the cluster’s OIDC keys.json and discovery.json to the storage bucket, making them publicly accessible for authentication verification.

Verify the upload

Confirm the file is valid JSON containing an issuer field that matches your bucket URL:

Create and bind the Google Service Account

With the cluster issuing valid OIDC tokens, the next step is creating a Google Service Account that Kubernetes workloads can impersonate.

Create the Google Service Account (GSA)

Create a Google Service Account that external identities can impersonate via Workload Identity for accessing Google Cloud resources.

Get the Workload Identity Pool name

Retrieve the full resource name of the Workload Identity Pool for configuring identity bindings.

Grant permissions to the GSA

Assign the necessary roles to the Google Service Account, including access to project resources and the ability to be impersonated via Workload Identity.
Things to note:
  • This grants roles/storage.admin, full administrative access to every bucket in the project, though the verification step later only lists the contents of one bucket. If you want tighter scoping, consider granting roles/storage.objectViewer on just the ${BUCKET_NAME} bucket instead, and adjust if your workload needs more.
  • Ensure the member string matches your specific Kubernetes configuration. The format is system:serviceaccount:<NAMESPACE>:<KSA_NAME>. In this example, we use the default namespace and the workload-identity service account.

Generate the Workload Identity configuration file

Create a local configuration file that maps the Kubernetes service account to the Google Service Account for authentication.

Deployment and verification

With the identity binding in place, deploy a test workload to confirm the whole chain works end to end.

Deploy credential configMap

Create a ConfigMap to store the credential configuration file, enabling the Pod’s Google SDK to perform the token exchange.

Create a Kubernetes service account

Create the Kubernetes Service Account that will be bound to the Google Service Account to authorize the workload.

Deploy test pod

Deploy a Pod that projects the Service Account token and credential configuration to verify the identity federation.

Verify access

Execute a command inside the running Pod to list the storage bucket contents, confirming that the Workload Identity authentication is functioning correctly.