SPIRE (SPIFFE Runtime Environment) is the production implementation of the SPIFFE specification. It is a CNCF graduated project and the most widely deployed SPIFFE-compliant identity provider. This module takes you inside SPIRE’s architecture.
SPIRE Server
The SPIRE Server is the central control plane. It is responsible for managing registration entries (which workloads get which SPIFFE IDs), performing node attestation (verifying that SPIRE Agents are running on legitimate nodes), signing SVIDs (issuing X.509 certificates and JWTs), maintaining the trust bundle (the CA certificates that verify SVIDs), and storing state in a datastore (SQLite, PostgreSQL, or MySQL).
SPIRE Agent
The SPIRE Agent runs on every node (as a DaemonSet in Kubernetes). It is responsible for performing workload attestation (verifying which process is requesting an identity), exposing the SPIFFE Workload API (Unix domain socket), caching SVIDs for registered workloads, and rotating certificates before they expire.
Node Attestation
When a SPIRE Agent starts, it must prove to the SPIRE Server that it is running on a legitimate node. This is node attestation.
# Kubernetes node attestation:
# Agent presents: Kubernetes service account token
# Server verifies: token with the Kubernetes API server
# AWS node attestation:
# Agent presents: AWS instance identity document
# Server verifies: document with AWS STS
# Azure node attestation:
# Agent presents: Azure MSI token
# Server verifies: token with Azure AD
Workload Attestation
When a workload calls the Workload API, the SPIRE Agent must verify the workload’s identity. This is workload attestation.
# Kubernetes workload attestation:
# Agent inspects: pod namespace, service account, labels, node
# Matches against: registration entries
# Unix workload attestation:
# Agent inspects: PID, UID, GID, binary path
# Matches against: registration entries
Registration Entries
A registration entry maps a set of workload attributes (selectors) to a SPIFFE ID:
# Register a workload:
spire-server entry create \
-spiffeID spiffe://example.org/ns/default/sa/api-server \
-parentID spiffe://example.org/agent/node-1 \
-selector k8s:ns:default \
-selector k8s:sa:api-server
# This says: any pod in namespace "default" with service account
# "api-server" running on a node attested as "node-1" gets the
# SPIFFE ID spiffe://example.org/ns/default/sa/api-server
SPIRE Plugin Framework
SPIRE uses a plugin architecture for extensibility. Node attestors, workload attestors, key managers, upstream authorities, and datastores are all pluggable. This allows SPIRE to work across cloud providers, orchestrators, and deployment models.
Deployment Models
- Single cluster: One SPIRE Server, Agents on every node
- Nested SPIRE: A hierarchy of SPIRE Servers for multi-tier architectures
- Federated SPIRE: Multiple independent SPIRE deployments that trust each other