Skip to main content
A workload on Google Cloud runs as a service account, and the metadata server hands it a Google-signed identity token on request. With workload identity federation, your workload exchanges that token for a KERNEL access token, so there’s no KERNEL_API_KEY in Secret Manager or your service’s environment.

Before you start

  • You’re an organization admin in KERNEL.
  • Your workload runs with a Google service account attached, on GKE, Cloud Run, Cloud Functions, or Compute Engine.
  • Your workload uses the TypeScript, Python, or Go SDK.

Find the service account’s unique ID

Google’s issuer, https://accounts.google.com, is shared by every Google Cloud customer. What tells your workload apart is the token’s subject: the service account’s numeric unique ID. Look it up:
The ID is a long number such as 104857600000000000000. It’s also on the service account’s details page in the Google Cloud console.

Configure KERNEL

1

Register Google as an issuer

In the dashboard, open Keys > Workload identity, click Connect workload, and select the Google Cloud tile. Google has one fixed issuer, so there’s nothing to enter except an optional Name. Click Apply and continue.Trusting Google’s issuer accepts no workload by itself. Each rule names the service account it allows.
2

Name the service account in a rule

Under Match conditions:Under Authorization, choose the Project, the Permissions, and the Token lifetime.
3

Pick a service account and enable

Choose or create a KERNEL service account, click Create rule, then turn on the issuer and the rule in the Test step. Copy the rule ID (wifr_...).

Configure your workload

Set two environment variables on the service, job, or instance:
Then construct the client with no arguments:

What the SDK does

For every exchange, the SDK asks the metadata server for an identity token for the attached service account, with the audience https://auth.onkernel.com and format=full, then exchanges it at https://auth.onkernel.com/token. To configure the source in code:

What the token looks like

Two details to make note of:
  • A Google identity token lasts 3,600 seconds. You can’t request a shorter one.
  • It carries no token ID. With no jti claim, KERNEL has nothing to mark as used, so a Google issuer always allows reuse: the same token can be exchanged again until it expires.
Because a Google identity token can be exchanged repeatedly for up to an hour, treat one like a credential for that hour. Don’t log it or pass it between services. Each KERNEL access token it yields still expires after the rule’s token lifetime, and disabling the rule stops new exchanges at once.

Narrow the rule

The numeric subject already pins one service account. To add more conditions, open Advanced matching in the rule and add an Additional claim condition. Claim conditions compare a claim by its JSON text, so a boolean matches the strings true and false:

Tokens from outside Google Cloud

A workload that isn’t on Google Cloud compute can still get a Google identity token by impersonating a service account. The generateIdToken method of the IAM Credentials API needs only the roles/iam.serviceAccountOpenIdTokenCreator role on that service account. gcloud auth print-identity-token --impersonate-service-account also needs roles/iam.serviceAccountTokenCreator. Pass the token to the SDK through a file or a callback, requesting the audience https://auth.onkernel.com.

Next steps