Lesson 04 of 14 · Workload identity
Workload identity with SPIFFE
Give every workload a cryptographic identity that does not depend on its IP: the SPIFFE standard, how a service mesh issues and rotates identities step by step, what SPIRE adds for workloads outside Kubernetes, and how identities work across clusters.
Identity that does not depend on the network
IP addresses in Kubernetes are temporary and shared over time. A rule like "allow 10.244.3.17" says nothing about what is calling. Workload identity gives each workload a verifiable name, carried in a credential it can prove it holds.
SPIFFE (Secure Production Identity Framework For Everyone, a CNCF standard) defines:
- SPIFFE ID: a URI naming a workload:
spiffe://<trust-domain>/<path>. Meshes in Kubernetes usespiffe://cluster.local/ns/<namespace>/sa/<serviceaccount>. - SVID (SPIFFE Verifiable Identity Document): the credential. Usually an X.509 certificate with the SPIFFE ID in its URI SAN (for mTLS), or a JWT-SVID (for places where TLS cannot carry identity, such as through a proxy).
- Trust domain and trust bundle: which CA keys vouch for identities in a domain.
- Workload API: a local endpoint (Unix socket) where a workload, or its proxy, fetches its SVIDs and bundles. No secrets baked into images.
Your seat number changes every lesson, so the teacher doesn't say "the pupil in seat 17 may collect the homework". She says "Asha from class 5 may collect it", and checks Asha's ID card, wherever she sits.
How a mesh issues identities, step by step
Pod "orders" starts (namespace shop, ServiceAccount orders)
1. The proxy (sidecar, or the node's ztunnel in Istio ambient) creates a private key locally.
The key never leaves the pod or node.
2. Proxy → control plane (istiod, linkerd-identity):
a certificate signing request + the pod's projected ServiceAccount token
3. Control plane → kube-apiserver TokenReview:
"is this token valid, and which ServiceAccount is it?" → shop/orders
4. Control plane signs a short-lived certificate (Istio default ~24h)
URI SAN = spiffe://cluster.local/ns/shop/sa/orders
5. Certificate + trust bundle delivered to the proxy in memory
(Istio uses Envoy's Secret Discovery Service, SDS)
6. Around half-way through its life, the proxy repeats 1-5. No restarts, no humans.
Then on every call, both proxies present their certificates, verify each other against the trust bundle, and the receiving side applies authorisation policy using the caller's SPIFFE ID (lesson 6).
Points to be precise about:
- The ServiceAccount is the identity. Share one ServiceAccount between services and they become indistinguishable. One ServiceAccount per service.
- Bootstrap trust comes from Kubernetes. Anyone who can create pods with a ServiceAccount can obtain its identity, so RBAC on
create podsmatters. - The data plane survives control-plane outages until certificates expire. Run the control plane highly available and alert well before expiry.
SPIRE: identity beyond one cluster
A mesh CA covers pods in its mesh. SPIRE (the reference SPIFFE implementation) extends identity to anything:
- Node attestation: the SPIRE agent proves which machine it runs on (cloud instance identity documents, Kubernetes projected tokens, TPM, join tokens).
- Workload attestation: the agent inspects the calling process (Kubernetes namespace and ServiceAccount, Unix user, container image) and matches it against registration entries.
- Workload API: workloads receive X.509 and JWT SVIDs, rotated automatically.
- Federation: two trust domains exchange bundles so
spiffe://prod.example.com/...andspiffe://partner.example.net/...can verify each other.
Use SPIRE when identities must span VMs, bare metal, several clusters or clouds, or when you want one identity system under several meshes.
Going deeper
Cloud providers increasingly accept SPIFFE JWT-SVIDs through OIDC federation: SPIRE publishes an OIDC discovery document and keys, and AWS IAM, Azure Entra ID or GCP can trust it. A workload then exchanges its SVID for short-lived cloud credentials, the same pattern as the next lesson, without being tied to one cluster's issuer.
Identity across clusters and cells
- Same root, different intermediates per cluster or cell: identities verify across clusters, and each cell's intermediate can be revoked on its own.
- Decide the trust domain naming early (
cluster.localeverywhere makes identities from different clusters look identical). Many organisations use a domain per environment or per cell. - Keep cells independent: cross-cluster identity is for shared platform services, not for making every cell depend on every other.
Try it
In a cluster with Istio or Linkerd, mesh two deployments that use different ServiceAccounts. Use the cheat-sheet commands to read the SPIFFE IDs from the certificates. Then deploy a third pod that reuses the first ServiceAccount and confirm it gets the same identity, which is why ServiceAccounts must not be shared.
Recap
- SPIFFE gives workloads a URI identity (SPIFFE ID) carried in an SVID (X.509 or JWT), independent of IPs.
- A mesh bootstraps identity from the ServiceAccount token (TokenReview), signs ~24h certificates, and rotates them automatically through the proxy.
- SPIRE extends identity to VMs, bare metal, many clusters and clouds through attestation and federation.
- One ServiceAccount per service; protect who can create pods; plan trust domains and per-cell intermediates.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.