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:
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:What the SDK does
For every exchange, the SDK asks the metadata server for an identity token for the attached service account, with the audiencehttps://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
- A Google identity token lasts 3,600 seconds. You can’t request a shorter one.
- It carries no token ID. With no
jticlaim, KERNEL has nothing to mark as used, so a Google issuer always allows reuse: the same token can be exchanged again until it expires.
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 stringstrue 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. ThegenerateIdToken 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
- Reference: Google Cloud match fields
- Troubleshooting: what a refused exchange means
- Move a workload from an API key