# spire-agent

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> Join a cloud workstation to your own SPIFFE trust domain, so software on it gets SVIDs from the Workload API.


Installs **SPIRE Agent**, points it at a SPIRE server you operate, and runs it as a
managed service, so ordinary SPIFFE client libraries on the workstation obtain SVIDs from
the Workload API with nothing written for them. Give it the four things it needs to
join your trust domain:

```yaml
devtools:
  - name: spire-agent
    config:
      serverAddress: spire.acme.example
      trustDomain: acme.example
      nodeAttestor: gcp_iit
      trustBundle: |
        -----BEGIN CERTIFICATE-----
        MIIB...
        -----END CERTIFICATE-----
```

Use it on **cloud** workstations. A local VM has no platform proof for a node attestor
to consume, so the agent would install and start there and then fail to attest;
`nodeAttestor` accepts only the three cloud attestors for that reason.

The rest of this page covers [the fields](#config-fields),
[what the agent sets up](#setup), and [two limits](#two-limits) worth knowing
before you rely on it.

## `config` fields

| Field | Type | Description |
|-------|------|-------------|
| `serverAddress` | `string` | **Required.** Your SPIRE server's host. |
| `trustDomain` | `string` | **Required.** The SPIFFE trust domain to join, e.g. `acme.example`. |
| `nodeAttestor` | `string` | **Required.** One of `gcp_iit`, `aws_iid`, `azure_msi`. |
| `trustBundle` | `string` | **Required.** The PEM bootstrap bundle the agent uses to authenticate the server. |
| `serverPort` | `string` | Optional. Defaults to SPIRE's own `8081`. |

All four required keys must be present together. With an incomplete set the binary is
still installed, but no service is started, and the workstation records a message naming
exactly which keys are missing.

<div class="callout callout-note">
  <p class="callout-title">This is delivery, not identity</p>
  <div class="callout-body">
    Your SPIRE server remains the system of record. Ringleader installs, configures and
runs the agent; it does not mint, verify or map any identity of its own here. A
workstation&rsquo;s own Ringleader identity is a separate mechanism.
  </div>
</div>


## Version behavior

| `version` | Result |
|-----------|--------|
| omitted | the release Ringleader installs by default, `1.15.5` today |
| `1.15.2`, `v1.15.2` | that release |

Ringleader downloads the release archive for the workstation's architecture and installs only the
agent binary, not the server or the rest of the distribution.

With `version` omitted, a workstation that already has the agent keeps its release, unless
`updatePolicy: latest` moves it. A changed `version` replaces the installed release on the next
configuration pass, whether it is newer or older, and a changed `config` is applied. The new release
runs once the service restarts. [Updates](#updates) describes both.

### SPIRE server compatibility

SPIRE does not support an agent that is newer than the oldest server it connects to, and patch versions
count. An agent may be up to one minor version older than the server. So set `version` yourself if your
oldest SPIRE server is older than the default release, or more than one minor version newer. For
example, with a server on 1.15.3, set `version` to `1.15.3`. SPIRE's
[upgrade documentation](https://github.com/spiffe/spire/blob/main/doc/upgrading.md) has the full rule.

## Updates

With `updatePolicy: latest` and no `version`, the SPIRE agent takes the
[Ringleader default route](https://docs.ringleader.dev/reference/tools/devtools/#update-routes). It moves when an
update to Ringleader raises the default release, and an installed agent that differs from the default
moves to it. Check that your SPIRE server supports the new default before you update Ringleader.

The agent restarts to run a new release. The restart waits for the workstation's
[maintenance window](https://docs.ringleader.dev/reference/tools/devtools/#service-restarts-and-maintenance-windows),
if it declares one. The same holds when you change `version`.

## Setup

- **The Workload API socket** at `/run/spire/agent/public/api.sock`. Workloads reach it
  by peer credential, so its location under `/run` does not need to be writable by
  them.
- **`SPIFFE_ENDPOINT_SOCKET`** exported in login shells, the variable every SPIFFE client
  library reads. This is what makes "a client obtains an SVID with nothing written for
  it" true.
- **A managed service** that runs the agent and restarts it on failure.
- **Persistent agent state**, so a rebooted workstation does not have to re-attest,
  which matters because the cloud node attestors are one-shot per instance.

## Two limits

**Local providers are not covered.** See above: use this on cloud workstations.

**This does not give you a SPIRE registration per workstation.** Workstations are
created on demand and torn down, so nobody can pre-create a SPIRE entry per machine.
The workable shape on the SPIRE side is a node alias parented on a coarse platform
selector (the project, the subscription, the account), with per-workload distinction
coming from the entries above it. Every workstation under that selector is then one
node identity inside SPIRE. Choose it knowingly; it is not a substitute for a
per-machine identity.

## Example

```yaml
apiVersion: workstations.ringleader.dev/v1
kind: WorkstationConfig
metadata:
  name: spiffe-box
  namespace: dev
spec:
  selector:
    matchLabels:
      tier: dev
  devtools:
    - name: spire-agent
      config:
        serverAddress: spire.acme.example
        serverPort: "8081"
        trustDomain: acme.example
        nodeAttestor: gcp_iit
        trustBundle: |
          -----BEGIN CERTIFICATE-----
          MIIBxTCCAWugAwIBAgIQ...
          -----END CERTIFICATE-----
```

## Notes

- A value that fails validation is dropped, and the workstation records how many
  declared values were unusable, so a malformed trust bundle shows up as a message.
- Works on Debian, Ubuntu and Alpine: SPIRE's Linux build is statically linked, so one
  artifact serves both families.

## Next steps
- [ServiceAccount and IdentityProvider](https://docs.ringleader.dev/reference/resources/serviceaccount/): the separate, inbound
  direction, letting a SPIFFE workload sign in to Ringleader as a service account
  through a `spiffe` identity provider.

