Skip to content
tezvyn:

SPIFFE: Cryptographic Identity for Services

Source: spiffe.ioMediumHow cards are made

SPIFFE gives every service a cryptographic passport instead of a static secret. It's used in zero-trust networks for services to authenticate each other, like in a Kubernetes service mesh.

Why it exists

In dynamic environments like Kubernetes, services need to securely identify themselves to other services. Hardcoding secrets, API keys, or long-lived certificates is brittle, insecure, and an operational nightmare. We need a way to automatically issue and rotate verifiable identities for software itself, regardless of where it runs.

The mental model

SPIFFE provides a universal identity system for services, like a passport office for your code. Instead of a service having a static password, it has a cryptographic "passport" called a SPIFFE Verifiable Identity Document (SVID). This SVID proves the service's identity to others. The SPIFFE framework defines the standards for these passports, and its implementation, SPIRE, is the agent that issues and validates them.

How it works

A SPIRE Server acts as the root authority for a "trust domain." It maintains a registry of which workloads are allowed which identities. SPIRE Agents run on each node (e.g., as a Kubernetes DaemonSet). The agent attests the identity of a workload running on its node based on platform-specific selectors (like a Kubernetes service account). If the workload is verified, the agent issues it an SVID via a local Workload API. The SVID can be an X.509 certificate or a JWT, which the workload then uses to authenticate to other services, often for mTLS.

When to use it

Use SPIFFE for service-to-service authentication in a microservices architecture, especially within a service mesh using proxies like Envoy. It's ideal for implementing zero-trust principles where no service is trusted by default. It excels in dynamic, multi-platform environments (Kubernetes, VMs, bare metal) where you need a consistent identity plane.

When not to use it

SPIFFE is not for human authentication; it's designed for machine-to-machine identity. It also introduces operational overhead. For very simple, static applications with only two or three services, managing a few API keys might be simpler than deploying and maintaining a full SPIRE infrastructure. It is overkill for monoliths that don't communicate with other services over the network.

One canonical example

In Kubernetes, you deploy a SPIRE Server as a StatefulSet and SPIRE Agents as a DaemonSet. You register a "payments-api" workload, telling the SPIRE Server that any pod with the payments-api service account is allowed the identity spiffe://my.domain/payments-api. When a payments pod starts, the SPIRE Agent on its node verifies its attributes, gets an SVID from the server, and provides it to the pod. The payments-api can now present this SVID to a database service to establish a secure mTLS connection.

Interview question

What is the primary benefit of using SPIFFE in a dynamic microservices environment?

  • a.It provides services with automatically issued and rotated cryptographic identities.Correct
  • b.It eliminates the need for any form of access control lists (ACLs) between services.
  • c.It simplifies human user authentication across multiple applications.
  • d.It automates the encryption of all inter-service network traffic.
Why?

Option A correctly identifies that SPIFFE's primary benefit is providing automatically issued and rotated cryptographic identities (SVIDs) for services. While these identities enable secure communication like mTLS (Option D), the core problem SPIFFE solves is the secure and dynamic management of service identities. Option C is incorrect as SPIFFE is designed for machine-to-machine, not human, authentication.

Just read this? Test yourself on what you have been reading.

Read the original → spiffe.io

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on kubernetes — each one lists the topics its interview covers.

See open roles