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 RSA keys for OIDC compatibility, 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.

GCP infrastructure

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.

Talos configuration

RSA key

Google Workload Identity Federation requires service account tokens to be signed with RSA. Starting with Talos v1.7, the Kubernetes service account signing key uses RSA by default, so no additional configuration is required. With that in place, the next step is to configure the API server to expose the correct OIDC issuer and audiences for Google Cloud.

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 a 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.

Identity binding & permissions

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.
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 & Verification

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.