Workload Identity
Workload Identity lets a pod in your managed Kubernetes cluster call the Frostmoln API using its Kubernetes ServiceAccount — with no long-lived API key stored in the pod. It is the Frostmoln equivalent of AWS IAM Roles for Service Accounts (IRSA), GCP Workload Identity Federation, and Azure Workload Identity.
A short-lived, scoped Frostmoln credential is minted for the pod on demand and refreshed automatically. Nothing secret is baked into your image or a Secret you manage.
Workload Identity needs the Workload Identity add-on on the cluster (Step 1). Without it, nothing in the cluster exchanges or injects credentials.
How it works
- You add the Workload Identity add-on to the cluster.
- You create a binding that maps a
(namespace, serviceAccount)in one of your clusters to a Frostmoln access policy — the policy defines the least-privilege grant (Step 2). - You annotate that Kubernetes ServiceAccount to opt it in.
- When a pod runs as that ServiceAccount, the add-on automatically:
- projects a short-lived Kubernetes ServiceAccount token into the pod,
- runs a small credential-helper sidecar that exchanges it for a scoped Frostmoln token, and
- writes that token to a file the app reads.
- Your app calls the Frostmoln API with the token. It is refreshed automatically before it expires (roughly hourly), so the app never handles a long-lived secret.
The exchange is one-way and outbound only: the platform never reaches into your cluster, and the pod trades a token it already holds for a Frostmoln token it is entitled to.
Step 1 — Add the Workload Identity add-on
Workload Identity is an optional cluster add-on, workload-identity.
- When you create a cluster — select Workload Identity in the portal's create form, pass
--addons workload-identitytofm kubernetes cluster create, or includeworkload-identityinaddonsonfrostmoln_kubernetes_cluster. The cluster reports running first; the add-on is applied a few minutes later. - To a running cluster —
- Portal — the cluster's Add-ons tab.
- fm CLI —bash
fm kubernetes cluster add-addons <cluster-id> --addons workload-identity - Terraform — add
workload-identitytoaddonsand apply again; the update adds it to the running cluster without replacing the cluster.
Adding it to a running cluster is not immediate: the addition starts its own reconciliation, and the add-on reaches the cluster typically within minutes. If that reconciliation cannot be started, it falls back to the platform's own reconciliation period, up to an hour.
Wait until the add-on is ready
Each add-on has a Readiness: whether it is actually serving, as the cluster's control plane reports it. Its state, Applied (converged), only means the platform applied it. On the cluster's Add-ons tab, Readiness shows as Ready, Starting, Not ready or Unknown. In fm kubernetes cluster addons <cluster-id> (the READINESS column, readiness with -o json) and in the readiness attribute of the frostmoln_kubernetes_cluster_addons data source, the same values are ready, starting, not_ready and unknown.
Unknown (unknown) means the platform has no current report; it is not a failure by itself. New values may appear, so treat anything other than Ready as not ready yet. If Unknown persists, or no Readiness is shown at all (an older platform release), check the add-on directly, for example by starting a test pod under an annotated ServiceAccount and checking that it has FROSTMOLN_WORKLOAD_CREDENTIALS_FILE, or contact support.
Wait until Workload Identity shows Ready (ready) before you start pods that need a credential. The add-on never holds up pod creation: a pod created before the add-on is ready starts without its injected credential, nothing reports it, and it is not fixed later. Recreate such pods once the add-on shows Ready (ready), for example:
kubectl rollout restart deployment/<name>Your nodes need outbound HTTPS
The add-on's image is pulled from registry.sweden.frostmoln.cloud when its pod starts; it is not preloaded onto your nodes. The token exchange calls api.frostmoln.cloud. Your worker nodes need outbound HTTPS to both. The platform does not check either; see Create a cluster.
Step 2 — Create a binding
A binding grants a specific ServiceAccount its permissions through an access policy attached to it. Flat scopes on bindings are retired: the platform refuses any binding carrying scopes (BINDING_SCOPES_RETIRED). Create the binding first — it stays inert until the policy is attached (Step 2b). Create it in the portal, with the fm CLI, or with Terraform.
Portal
On the cluster's detail page, open the Workload Identity tab and choose Add binding. Enter the namespace and service account name, and save. The binding is granted by attaching an access policy afterwards — the modal says where.
fm CLI
fm kubernetes workload-identity binding create \
--cluster <cluster-id> \
--namespace default \
--service-account my-app
# List and delete
fm kubernetes workload-identity binding list --cluster <cluster-id>
fm kubernetes workload-identity binding delete <binding-id>Terraform
resource "frostmoln_workload_identity_binding" "my_app" {
cluster_id = frostmoln_kubernetes_cluster.prod.id
namespace = "default"
service_account = "my-app"
}Step 3 — Annotate the ServiceAccount
Opt the ServiceAccount in by adding the annotation frostmoln.cloud/workload-identity: "true":
apiVersion: v1
kind: ServiceAccount
metadata:
name: my-app
namespace: default
annotations:
frostmoln.cloud/workload-identity: 'true'or imperatively:
kubectl -n default annotate serviceaccount my-app \
frostmoln.cloud/workload-identity=trueOnly ServiceAccounts carrying this annotation are wired up — it is opt-in per ServiceAccount.
Pods that are already running
From add-on v0.3.0-1, annotating a ServiceAccount restarts its running pods so they receive the credential. They are evicted one at a time, honouring PodDisruptionBudgets, and their controller recreates them. Bare pods and Job pods are not restarted; restart them yourself. Earlier versions only inject pods created after the annotation.
Step 4 — Use the credential in your pod
Run your pod as the annotated ServiceAccount. The add-on injects everything automatically; your app only needs to read the token from the file named by the FROSTMOLN_WORKLOAD_CREDENTIALS_FILE environment variable and send it as a bearer token:
curl -H "Authorization: Bearer $(cat "$FROSTMOLN_WORKLOAD_CREDENTIALS_FILE")" \
https://api.frostmoln.cloud/api/v1/...token, _ := os.ReadFile(os.Getenv("FROSTMOLN_WORKLOAD_CREDENTIALS_FILE"))
req.Header.Set("Authorization", "Bearer "+strings.TrimSpace(string(token)))The file is refreshed in place before the token expires, so re-read it (rather than caching its contents) for long-running processes.
Credential in a Secret
Some tools read credentials from a Kubernetes Secret rather than a file — the External Secrets Operator is one. For them, annotate the ServiceAccount with frostmoln.cloud/workload-identity-secret: <secret-name>:
apiVersion: v1
kind: ServiceAccount
metadata:
name: eso
namespace: default
annotations:
frostmoln.cloud/workload-identity-secret: frostmoln-tokenThe add-on then keeps an Opaque Secret of that name in the same namespace, holding the exchanged Frostmoln token under the key token. It still needs a binding for that namespace and ServiceAccount — attach a policy granting the secrets read the operator needs. The frostmoln.cloud/workload-identity: "true" annotation is not needed; the two modes are independent.
- Lifetime — the token lasts about an hour and is refreshed automatically at about 80% of its lifetime.
- Labels — the Secret carries
app.kubernetes.io/managed-by: frostmoln-workload-identityandexternal-secrets.io/type: webhook, so ESO's webhook provider can read it. - Never overwrites — if a Secret with that name already exists and the add-on did not create it, nothing is written. Pick another name.
- Removal — removing or renaming the annotation deletes the Secret, and so does deleting the ServiceAccount.
- Not in platform namespaces — such as
kube-system.
Anyone who can read Secrets in the namespace can read the token
Keep the Secret in a namespace with tight RBAC. Unlike an API key, the token is short-lived.
Scopes are retired
Flat scopes on bindings are retired (retire-scopes, 2026-10-21). A binding can no longer carry them: any create or update that sends a set is refused with BINDING_SCOPES_RETIRED, and older tooling that still tries to set --scope / scopes fails with that code carrying the migration. A binding's grant is its access policy — see the next section.
The platform's own scope vocabulary (compute:read and friends) survives as API key authoring material — and as the stored scopes of keys issued before the retirement (2026-10-21): those keys keep validating with their scopes until they are migrated or cleared, but nothing can mint, edit or narrow scopes any more. A key's grant is its access policies, whose operations name the same service:resource:action permissions.
Grant with an access policy
An access policy is the only grant language a binding speaks. A policy names individual resources and operations, can add conditions such as a source-IP range, and denies explicitly — for a workload that should touch one bucket from one network, nothing else expresses that.
Create the binding and attach a policy to it:
fm kubernetes workload-identity binding create \
--cluster <cluster-id> --namespace ops --service-account reaper
# Attach a policy to it
fm iam policy attach <policy-id> --type workload_identity --id <binding-id>In the portal, add the binding on the cluster's Workload Identity tab, then attach a policy under Settings → Access Policies (copy the binding ID from the tab). In Terraform, add a frostmoln_iam_policy_attachment next to the binding resource.
Until a policy is attached the binding is inert: with no grant at all the token exchange refuses to mint rather than issuing a credential that grants nothing — the pod's credential helper reports an error instead of getting a dead token. Two more properties are worth knowing:
- A binding can never be left granting nothing. Removing its last remaining grant — its last policy — is rejected (
BINDING_WOULD_HAVE_NO_GRANT). Delete the binding instead. - A binding that still carries pre-retirement scopes applies those scopes and nothing else until it is migrated. Migrate per binding: attach a policy carrying the same permissions, verify the workload still passes, then remove the scopes — that removal is the last write, and the platform guards it the same way.
Access policies require the IAM access policies feature on your tenant.
Token lifetime
The minted Frostmoln token is short-lived (about one hour) and refreshed automatically by the injected credential helper. There is no long-lived secret to rotate: revoking access is a matter of deleting the binding (or removing the annotation), after which no new tokens are minted for that ServiceAccount.
Policy changes reach running workloads within about a minute. A token that is already issued does not keep the access it was minted with: editing an access policy that applies to the binding, attaching or detaching one, or changing a group it gets a policy through all apply to the next requests within about a minute. Narrowing access takes effect as quickly as widening it, and deleting the binding stops its already-issued tokens just as fast.
Removing access
- Delete the binding (portal,
fm kubernetes workload-identity binding delete, orterraform destroy) to revoke its access. - Remove the annotation from the ServiceAccount to stop injecting credentials into new pods.
Removing the add-on
Remove the add-on from the Add-ons tab, with fm kubernetes cluster remove-addons <cluster-id> --addons workload-identity, or by dropping the key from addons in Terraform. Its webhook is removed first: pods already running keep their injected sidecar until they are restarted. Synced Secrets are no longer refreshed, and their token expires within about an hour.
Deleting the binding is also how you remove a workload's access entirely — a binding cannot be emptied down to granting nothing.
Terraform: destroy a policy-granted binding before its attachment
Because a binding can never be left with no grant, detaching its only policy is rejected. terraform destroy removes the attachment first (it depends on the binding) and therefore fails. Destroy the binding first; that removes its attachments with it:
terraform destroy -target=frostmoln_workload_identity_binding.my_app
terraform destroyThe same applies to any change that replaces the binding — cluster_id, namespace and service_account all force replacement.
Updating the add-on
Moving the add-on to a newer version (see Add-on versions on the Kubernetes page) updates its webhook as soon as the new version is applied. Pods that are already running keep the credential helper they were started with until they are recreated. Once the new version shows as applied, restart your workloads so they pick up the new helper, for example:
kubectl rollout restart deployment/<name>This matters most when the new version is a security fix: until a pod is recreated, it still runs the old helper.
Troubleshooting
- The pod has no injected credential (no
FROSTMOLN_WORKLOAD_CREDENTIALS_FILEand no credential-helper sidecar) — the pod was most likely created before the add-on was ready, and it is not injected afterwards. Check Readiness withfm kubernetes cluster addons <cluster-id>or the Add-ons tab, then recreate the pod once it shows Ready (ready) (kubectl rollout restart deployment/<name>). Also check that the pod runs as a ServiceAccount carrying thefrostmoln.cloud/workload-identity: "true"annotation.