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 authenticationRetrieve 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 OIDCkeys.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.