Workload Identity Explained: cert-manager, SPIFFE and Service Meshes

Listen to this article8 min
Read by an AI voice

It is not only people who sign in, but programs too: an order service calls the payment service, a container reads from a database, a build server uploads to the cloud. For years this was done with passwords and API keys in configuration files, which got copied, forgotten and stolen. Modern platforms give each service a workload identity instead: a short-lived certificate or token that arrives and expires automatically. This guide explains the principle, cert-manager for Kubernetes, the SPIFFE standard with SPIRE, service meshes with mutual TLS, and how to reach the cloud without stored keys.

Why services need an identity of their own

A password in a configuration file has three problems: it usually stays valid for years, copies sit on many machines and in code repositories, and nobody knows exactly which service is using it. A workload identity turns this round:

  • Proof instead of a secret: the service proves who it is, for example through the platform it runs on.
  • Short lifetime: certificates last hours rather than years and are renewed automatically.
  • No person in the loop: nobody copies keys, so nobody can lose them.

Technically these are usually X.509 certificates for mutual TLS between services, or signed tokens for cloud APIs; see what is mutual TLS.

Two columns: a password in a configuration file stays valid for years and gets copied, a workload identity lasts hours and renews automatically.
Why services get short-lived identities.

cert-manager: certificates in Kubernetes

cert-manager is the standard tool for certificates in Kubernetes and has been a “graduated” project of the Cloud Native Computing Foundation (CNCF) since November 2024. You describe the certificate you want as a Kubernetes object, cert-manager obtains it and stores it, with its key, as a Secret. The source is called an issuer: an ACME service such as Let’s Encrypt, your own CA, HashiCorp Vault or a commercial provider. Here is an internal certificate with a 24-hour lifetime (names as examples):

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: payments-tls
spec:
  secretName: payments-tls
  duration: 24h
  renewBefore: 8h
  dnsNames:
    - payments.shop.svc.cluster.local
  issuerRef:
    name: internal-ca
    kind: ClusterIssuer

cert-manager renews this one eight hours before expiry, so after 16 hours. Without that setting it renews when a third of the lifetime is left. For ACME see ACME in depth, and for your own CA how to run a private certificate authority.

Timeline over 24 hours: with renewBefore set to 8h, cert-manager renews the certificate after 16 hours.
Worked example for the Certificate object in the text.

SPIFFE and SPIRE: an ID card for every service

SPIFFE (Secure Production Identity Framework For Everyone) is an open standard for workload identities, and SPIRE is its reference implementation; both have been graduated CNCF projects since 2022. Every service receives a SPIFFE ID, a URI such as spiffe://shop.example/payments. The matching credential is called an SVID and is either an X.509 certificate with the SPIFFE ID in the Subject Alternative Name field or a JWT. Issuing works like this:

  • A SPIRE agent on each node proves itself to the SPIRE server, for example through the cloud instance or the machine’s TPM (node attestation).
  • When a service starts, the agent checks it against attributes such as Kubernetes namespace, service account or container image (workload attestation).
  • If it matches an entry, it receives its SVID and key through a local interface, along with the trust bundle, the CA certificates it should trust.

By default SPIRE issues X.509 SVIDs valid for one hour and renews them continuously. A stolen key is worthless after a short time, and a revocation list is barely needed; see how certificate revocation works.

Four steps: the SPIRE agent proves itself to the server, checks the starting service and hands it an SVID with its SPIFFE ID plus the trust bundle.
Node and workload attestation in SPIRE.

Service mesh: mutual TLS without writing code

A service mesh such as Istio or Linkerd places a proxy or node agent next to every service to handle its network traffic. The mesh has its own CA, gives every service a certificate in SPIFFE format and encrypts every connection with mutual TLS. In Istio and Linkerd the certificates last 24 hours by default. The application code notices none of this. Rules then decide which service may talk to which, based on the identity in the certificate rather than the IP address. That is a core building block of zero trust: no service trusts another just because it sits on the same network. To get started with containers, see how to install Docker.

Reaching the cloud without stored keys

Access to cloud services can do without permanent keys too:

  • Federation with OpenID Connect: a build server such as GitHub Actions receives a signed token for each run, which AWS, Azure or Google Cloud exchange for short-lived credentials. How such tokens are checked is explained in OAuth 2.0 and OpenID Connect explained.
  • Certificates: AWS IAM Roles Anywhere exchanges an X.509 certificate from your own CA for temporary credentials, for example for servers in your own data centre.
  • Platform identities: virtual machines and functions in the cloud get their identity from the provider itself, with no secret stored on the machine.

Frequently asked questions

Do I need SPIFFE for a small project?

Usually not. cert-manager with an internal CA, or a service mesh, is enough for many clusters. SPIFFE pays off when services need to trust each other across platforms and clouds.

Why such short lifetimes?

The shorter a certificate lasts, the less a thief can do with it. Because renewal is automatic, the short lifetime costs no effort.

What happens if the internal CA fails?

Services can no longer connect once their certificates expire. That is why the CA and SPIRE servers run redundantly, and lifetimes and renewal times leave a margin.

Do workload identities replace API keys completely?

For your own services and the large cloud providers, often yes. Some third-party services still demand static keys; those belong in a vault such as HashiCorp Vault.

Conclusion

Workload identities replace passwords in configuration files with automatically issued, short-lived certificates and tokens. cert-manager obtains certificates in Kubernetes, SPIFFE and SPIRE give every service a verifiable identity, service meshes encrypt every connection with mutual TLS, and OIDC federation opens the cloud without stored keys. More guides in the hub Certificates, PKI and encryption.

Sources and further reading

Rating: 4.94/5. From 31 votes.
Please wait...


The Tech Crates editorial team. Tech Crates is run by Carsten Kraft, an IT consultant and software developer from Germany with more than 25 years of experience in enterprise software and a specialist in PKI and certificate management (carsten-kraft.com). Practical tech guides since 2010.