Attesting a workload
The render service now has a name, spiffe://printer.example/prod/render, but a fresh copy still has to show that the name is its own, and to get a credential it seems to need a credential. This lesson shows how the platform the workload runs on can vouch for it instead, how that evidence becomes a short-lived credential, and what it leaves unproven.
The first secret
The printer's team has decided that every workload will get its own identity, starting with the render service. When a new copy of the render service starts, it must prove it is the render service before anything will give it a credential. The tempting answers all hand it a secret before it starts.
The team could bake the secret into the container image, the packaged copy of the service's code and files that every copy starts from. It could pass the secret in an environment variable when the service is deployed, or mount a file holding it. Each answer moves the problem rather than solving it. Whoever can read the image, the deployment settings or the file now has the secret too. The secret lasts as long as the image or setting that carries it, which is often months. And it proves very little: presenting it shows that the caller obtained a copy, not where the caller runs, what code it is, or how it was deployed.
A secret manager, a service that stores secrets and hands each one only to callers that authenticate to it, does not escape this on its own. It is a good place to keep the render service's other secrets, but the render service must authenticate to the secret manager somehow, and that credential is the same first secret again. The problem is often called secret zero, or bootstrapping.
The way out is a party that already knows where the workload runs and how it was started, and that does not have to take the workload's word for either.
What the platform already knows
The printer's services run on a cloud platform. The platform rents the printer virtual machines, computers simulated in software on the platform's hardware, and on them a container orchestrator starts and stops each copy of each service in its own isolated container. Between them, those two systems know a great deal about every running copy of the render service.
The cloud platform started the virtual machine, so it knows which account the machine belongs to, which machine image it booted and where it runs. Many platforms let a machine fetch a signed document describing itself from a local address only the machine can reach. The machine can read that document, but it cannot change it without breaking the platform's signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message..
The orchestrator started the render service's container, so it knows the image it is running and two settings the printer chose when it deployed it: the namespace, a named partition of the cluster such as prod that groups related services, and the service account, the orchestrator's own account for that service, here render. Many orchestrators can give a container a short-lived signed token that says so. The most common real example is a Kubernetes projected service account token. Kubernetes, a widely used orchestrator, mounts a short-lived signed JWTA JSON Web Token: a compact token made of Base64url-encoded parts that carries claims and is usually signed. Anyone holding it can decode and read the claims, so the signature shows who issued it but hides nothing. into the container, addressed to an audience and with an expiry the deployment chose, and the cluster itself acts as the token's issuerThe party that creates and signs a token, assertion, or certificate, named in a token's iss claim. A recipient must check that the issuer is exactly the one it expected and trusts., publishing a discovery documentA JSON document that an OpenID Provider publishes at a well-known address under its issuer, listing its endpoints, where to find its signing keys, and its supported features so clients can configure themselves from one value. and keys so a verifier can check it. Its shape, simplified, is:
{
"iss": "https://kubernetes.printer.example",
"sub": "system:serviceaccount:prod:render",
"aud": ["identity.printer.example"],
"kubernetes.io": {
"namespace": "prod",
"serviceaccount": { "name": "render", "uid": "f0e1..." },
"pod": { "name": "render-7f9c4", "uid": "a24c..." }
},
"iat": 1790000600,
"exp": 1790001200
}All domains, credentials, and tokens in these examples are fictional. The subject is the cluster's own name for the account, system:serviceaccount:<namespace>:<name>. The orchestrator's facts sit under the kubernetes.io claim, including the pod, Kubernetes' name for one running copy, and the cluster signed all of them, so a verifier reads them from a place the workload could not have written. The token is meant for one audience, the printer's identity service, and expires after ten minutes. Physical machines can supply similar evidence from a TPM, a chip whose built-in key never leaves the hardware.
Evidence like this is called attestation: statements about a machine or process made by a party the verifier already trusts, rather than by the workload about itself. The render service never chose any of these facts, which is what makes them worth checking.
Checking the machine, then the process
Turning attestation into identity usually happens in two steps. SPIRE, the reference implementation of SPIFFEAn open standard for workload identity. It names each workload with a URI under a trust domain, such as spiffe://printer.example/prod/render, and defines short-lived identity documents as X.509 certificates or JWTs., shows them clearly. A central identity server issues identities for the printer.example trust domain, and a small node agent runs on every machine.
The first step is node attestation. When the node agent starts, it presents the cloud platform's signed machine document to the identity server. The server checks the platform's signature and confirms that the machine belongs to the printer's production account. Only then does it treat the node agent as a trusted part of the trust domain and tell it which workloads may run on that machine.
The second step is workload attestation, and it happens every time a workload asks for an identity. The render service calls the node agent through a local APIAn application programming interface: a defined way for software to interact with a service. A web API offers endpoints where other programs send HTTP requests. on the same machine. It presents no secret. Instead, the node agent looks at the caller from the outside. The operating system tells it which process made the call. The orchestrator tells it which container that process belongs to, along with the namespace, the service account and the image. These observed facts are called selectors.
The identity server holds a registration entry for each identity, describing which selectors a workload must have to receive it:
Identity: spiffe://printer.example/prod/render
Runs on: machines in the printer's production account
Selectors: namespace = prod
service account = render
image signed by = printer release pipelineIf what the node agent observed matches an entry, the render service receives that identity. The workload never had to hold a secret: facts it cannot easily fake, reported by the operating system and the orchestrator, decided who it is.
From evidence to a credential
What the render service receives is a credential for its identity, typically a short-lived certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name. or signed token that lasts minutes or hours. The node agent renews the credential well before it expires and hands the new one to the service through the same local API, so the service never manages renewal itself. Credentials for workloads compares those formats in more depth.
When nothing matches, nothing is issued. If someone deploys the render service into the wrong namespace by mistake, it receives no identity and its calls fail:
That failure is the right outcome. A workload that does not look like the registered render service should not be able to act as it, and a failed call is easier to notice and fix than a copy quietly running with an identity it was never meant to have.
It also makes the registration entries some of the most sensitive settings the printer has. Whoever can create or edit them decides which software can become the render service, so changes to them deserve the same review and the same audit trail as changes to permissions.
What attestation does not prove
Attestation shows where code runs and how it was deployed. It does not show that the code is safe or behaving as intended. If the render service has a vulnerability and an attacker takes control of a running copy, the attacker can use the render service's identity for as long as they control it. Attestation narrows who can obtain an identity; it does not make the workload trustworthy.
A compromised machine is the harder case. An attacker with full control of a machine can ask the local node agent for any identity registered to run there. They cannot obtain identities for workloads that are not allowed on that machine, because the identity server answers each node agent only for its own entries. So the printer runs its most sensitive workloads on separate machines and registers each identity only where it is meant to run. Short credential lifetimes help too: once the machine is cleaned up or replaced, whatever the attacker obtained stops working within minutes or hours.
The most common mistake is a weak selector. An entry that gives the render identity to "any process in namespace prod" lets every workload in that namespace become the render service. Specific selectors, such as the service account together with an image signed by the release pipeline, keep each identity attached to the software it was meant for.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Let the platform vouch for a workload instead of handing it a secretRegister a hosted workload with a deployment pin it cannot match, see it refused, repair the pin, and prove an old credential cannot survive a registration change.