kubernetes.io/namespace and kubernetes.io/serviceaccount/name), not only the sub string.
For concepts and the shared exchange API, see Workload Identity Federation.
Prerequisites
- A cluster with projected service-account tokens enabled (default on current Kubernetes).
- The cluster OIDC issuer and JWKS reachable from the TrueFoundry control plane (or your platform team can expose them).
- A Virtual Account or Agent with the permissions the workload needs.
Get the cluster issuer and JWKS
Project a service-account token
Mount a projected token into the pod. Setaudience to a value you will also list under Allowed Audiences on the TrueFoundry Identity Provider (for example truefoundry).
/ paths:
Configure TrueFoundry
- Settings > Security & Access > Identity Providers → add provider type Kubernetes.
- Set Issuer URL and JWKS URI from the cluster discovery document. Set Allowed Audiences to the same audience as the projected token (for example
truefoundry). - On the Virtual Account (or Agent), add a mapping for that provider:
claims)
kubernetes: kubernetes.io/namespace, kubernetes.io/serviceaccount/name. Paths use / as the nested-object separator; the dots in kubernetes.io are part of the key name. You may add further claim matches when your token includes them and you want to pin them.
Exchange and call TrueFoundry
<tenant-host-origin> is the issuer origin from OpenID discovery. The exchange path is /{tenant}/oauth2/v1/token (no /api/svc). Prefer token_endpoint from GET https://<tenant-host-origin>/<tenant>/.well-known/openid-configuration.
Use the returned access_token as Authorization: Bearer on the AI Gateway or APIs. For Agents, set tfy_subject to agent:<agent-name>. Full exchange details: Workload Identity Federation.
Scope the mapping
- Pin both namespace and service-account name — do not map a whole cluster to one Virtual Account unless that is intentional.
- Use the same audience on the projected token and the Identity Provider Allowed Audiences list.
- Prefer one Virtual Account (or Agent) per workload identity boundary.