Workload identity federation
Workload identity federation lets a workload authenticate as a service account using a token that its own infrastructure signs and rotates. The platform trusts the issuer, verifies the token, and resolves it to the service account. Nothing long-lived is stored in the workload's environment.
This is the recommended way to authenticate a workflow worker running in your own Kubernetes cluster. For a workload that cannot present an issuer-signed token, give the service account an API key instead.
How setup works
Setup runs in the following order.
- An organization admin registers your cluster as a trusted issuer, once per external OIDC provider or Kubernetes cluster.
- A workspace admin creates the service account in Mistral.
- You create the matching Kubernetes service account in your cluster. This is the workload's identity.
- The workspace admin adds a workload identity credential, proving your workload owns that identity.
- You deploy the worker with a projected token so it authenticates automatically.
A single trusted issuer can validate tokens for multiple credentials, and a single service account can be authorized by multiple credentials.
Key concepts
| Concept | What it is | Who manages it |
|---|---|---|
| Trusted issuer | A pre-approved OIDC issuer, typically one Kubernetes cluster, whose signed tokens the platform trusts. | Organization admin |
| Subject | The workload's identifier inside that issuer, for example system:serviceaccount:<namespace>:<name>. | You, in your cluster |
| Credential | The link that lets a workload with a given subject authenticate as a service account. | Workspace admin |
| Proof of ownership | A freshly signed token that proves you control the subject before the credential is created. | Workspace admin |
Register a trusted issuer
An organization admin registers each cluster that will run your workloads. Do this once per cluster.
- Open Admin Console›Organization›Trusted issuers ↗.
- Click Register new trusted issuer.
- Fill in the following fields.
- Click Register.
| Field | Required | Notes |
|---|---|---|
| Name | Yes | A human-readable label, for example gcp-production. |
| Issuer URL | Yes | The cluster's OIDC issuer URL, the expected iss claim on its tokens. |
| JWKS URI | No | Where the platform fetches signing keys. Leave empty to discover it automatically through OIDC. Most clusters need no value here. |
An issuer URL can be registered once per organization. Registering the same issuer URL again returns an error.
Set up the Kubernetes service account
Create a Kubernetes service account for the workload. This is the identity the workload presents, and it must exist before you add the credential.
apiVersion: v1
kind: ServiceAccount
metadata:
name: example-worker
namespace: workflows
# subject -> system:serviceaccount:workflows:example-workerAdd a workload identity credential
The credential records which subject can authenticate as the service account. You do not type the subject in: the platform reads it from a token that the trusted issuer signed for that workload, which is what proves you control it.
- Open the service account and click Add new authentication.
- In the Add credential dialog, choose Workload identity federation.
- Select a Trusted issuer from the ones your organization has registered.
- Click Create registration. The platform generates a one-time Audience of the form
mistral-auth:<nonce>. Copy it. - Mint a token for your workload carrying that audience. Expand Using Kubernetes? to copy a ready-made command, then replace the service account name and namespace:
kubectl create token example-worker -n workflows \
--audience="mistral-auth:<nonce>" \
--duration=10m- Paste the result into Proof token.
- Optionally set an Expiration. Leave it empty for a credential that never expires.
- Click Create credential.
The platform verifies the issuer's signature and matches the audience against the registration. The credential's subject is taken from the verified token, so it always reflects the workload that actually produced the proof.
The audience is random and unguessable, and it is used only once, to register the credential. Only someone who can run the workload can mint a token stamped with it. At runtime the worker authenticates with the api-gateway audience instead.
The token you mint is short-lived. Mint it and submit it within its validity window, or the platform rejects it.
Deploy the worker
Run the worker as the Kubernetes service account you created, and give it a projected service account token: a JWT the cluster signs and the kubelet rotates on disk before it expires. At runtime the token uses the api-gateway audience.
Point the worker at the token file with MISTRAL_SA_TOKEN_PATH, and do not set an API key: its presence takes precedence over the service account token.
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-worker
namespace: workflows
spec:
replicas: 1
selector:
matchLabels: { app: example-worker }
template:
metadata:
labels: { app: example-worker }
spec:
serviceAccountName: example-worker
containers:
- name: worker
image: <your-worker-image>
env:
- name: MISTRAL_SA_TOKEN_PATH
value: /var/run/secrets/mistral-sa/token
- name: MISTRAL_CLIENT_SERVER_URL
value: https://api.mistral.ai
volumeMounts:
- name: mistral-sa-token
mountPath: /var/run/secrets/mistral-sa
readOnly: true
volumes:
- name: mistral-sa-token
projected:
sources:
- serviceAccountToken:
path: token
expirationSeconds: 600
audience: api-gatewayManage and rotate
A service account's Credentials list shows its workload identity credentials, with the subject, the trusted issuer, and the expiry.
- Rotate a credential by adding a new one and deleting the old one. Both can stay active during the overlap, so the worker keeps authenticating throughout.
- Delete a credential to stop that workload from authenticating as the service account.
Rotating a workload identity credential does not change the service account itself, so a hardened deployment that trusts the service account needs no update.