Skip to content

The SPIRE agent

The SPIRE agent is a node-local daemon, deployed as its own DaemonSet alongside xratud. It attests workloads on its node and serves them certificates over a Unix socket. xratud and every project runtime kernel consume that socket as ordinary workloads.

Why the agent is a separate daemon

xratud decides what should run on the node. The agent vouches for who a workload is. If the component that starts workloads also minted their identities, a compromised scheduler could mint an identity for anything it chose to start.

flowchart TB
  subgraph node["Data plane node"]
    AG["SPIRE agent<br/>DaemonSet"]
    XD["xratud<br/>StatefulSet"]
    RT["Project runtime<br/>kernel"]
    SK["/run/spiffe/workload-api/spire-agent.sock"]
    AG --- SK
    XD -->|"Workload API"| SK
    RT -->|"Workload API"| SK
  end
  SRV["SPIRE server<br/>trust domain authority"]
  AG -->|"node attestation<br/>SVID issuance"| SRV
  XD -.->|"mTLS, both ends present SVIDs"| RT

Their shared surface is the socket. Assignment state stays with xratud; signing authority stays with SPIRE.

What the install renders

xratu dataplane install prepare writes the cluster-local substrate as an ordinary manifest in the bundle:

ls install/${DP_INSTALL}/k8s/
spire-workload-identity.yaml  ...

The manifest creates the spire-system namespace and everything in it:

Object Purpose
spire-server StatefulSet and Service Trust domain authority for the cluster, serving on 8081
spire-agent DaemonSet One agent per data-plane node, serving the Workload API socket
spiffe-csi-driver Publishes the socket into pods as a volume, attachRequired: false and podInfoOnMount: true
spire-server-config, spire-agent-config ConfigMaps The server and agent HCL configuration
xratud-spire-registration-intent ConfigMap The derived registration entries for the expected xratud pods
CSIDriver csi.spiffe.io The driver registration the CSI volume references

Images are pinned to exact versions in the rendered manifest:

ghcr.io/spiffe/spire-server:v1.15.2
ghcr.io/spiffe/spire-agent:v1.15.2
ghcr.io/spiffe/spiffe-csi-driver:0.2.6

On a disconnected network these are three more images to mirror, alongside the platform images. See Air-gapped deployment.

The substrate is applied before nodes scale

apply runs the phases in a fixed order, and the identity substrate comes before any node process exists to need it:

flowchart LR
  T["Terraform<br/>identities and grants"] --> SA["Service accounts"]
  SA --> SP["SPIRE substrate"]
  SP --> PA["Project runtime authority"]
  PA --> F["Private fabric"]
  F --> SC["Scale to dp_count"]

The Workload API socket therefore exists before the first xratud pod starts. A node that came up first would find no socket, fail to obtain an SVID, and sit in reconnect backoff until the agent appeared.

How a workload reaches it

The socket is published into pods by the CSI driver:

volumes:
  - name: spiffe-workload-api
    csi:
      driver: csi.spiffe.io
      readOnly: true
mount    /run/spiffe/workload-api
env      SPIFFE_ENDPOINT_SOCKET=unix:///run/spiffe/workload-api/spire-agent.sock

Both xratud and project runtime pods get the same mount and the same environment variable. A runtime pod additionally carries its expected identity as an annotation and exposes the control lane:

metadata:
  annotations:
    xratu.io/spiffe-id: spiffe://xratu/workspace/<workspace_uuid>/runtime/<runtime_instance_id>
spec:
  ports:
    - name: kernel-grpc-control
      port: 7777

Issuance lifetimes

Setting Value Consequence
default_x509_svid_ttl 3600s A workload certificate is valid for an hour; the agent pushes a replacement well before it expires
ca_ttl 24h The signing CA rotates daily, so the SPIFFE trust bundle changes over time

Certificates on the lane expire within the hour.

The Workload API is a stream

FetchX509SVID is a server-streaming call. The workload opens it once and the agent pushes replacements as it issues them, including trust bundle updates that leave the certificate unchanged.

An agent restart therefore reaches a running workload as a broken stream rather than as a failed request. See Credential rotation for how recovery behaves.

What the operating environment owns

Applying registration entries. The install renders registration intent into a ConfigMap. Applying entries to a SPIRE server is a privileged operation owned by whoever operates SPIRE, and the reconciler that performs it consumes the derived intent.

Trust domain bootstrap and bundle distribution. Establishing the trust domain's root of trust and distributing its bundle belong to the operating environment.

Key issuance. All key material for the lane originates in SPIRE. The kernel binds to the Workload API and consumes what the agent sends.