Skip to content

Reading an instance's identity from the cluster

Until 2026-11-20 the only place an identity was recorded was one annotation on the claim (byre.io/identity, the client's key fingerprint). Everything else was a constant: the SandboxTemplate put hermes.profile: default on every pod regardless of who held it, so kubectl get pods showed a pool of identical sandboxes and the reasonable-but-wrong conclusion was "the default profile is running twice".

Two things make it visible now: the claim carries byre's own byre.io/identity-ref label, and the operator's per-identity value travels with the claim into the pod through spec.additionalPodMetadata. The template stops claiming to know the identity, because a constant is worse than nothing.

What byre writes

On every object it binds (claim or pod):

key kind value
byre.io/identity annotation the exactly-normalised fingerprint
byre.io/identity-ref label the same value transliterated for label syntax (+→-, /→_, = dropped)
byre.io/instance, byre.io/uid annotations the object's name and UID
anything under identities[].labels labels operator-declared; on the claims path the key must carry an allowlisted domain
anything under identities[].annotations annotations operator-declared; delivered to the pod, no domain required

Config:

identities:
  - fingerprint: "WcHWo47zy7eNKb8CgeTkYX4rjr4CoNcp+xtNo63NYRE"
    backend: sandbox
    name: eng
    labels:
      sandbox.users.io/profile: eng   # selectable, and legal for the sandbox controller
    annotations:
      hermes.profile: eng                    # the unqualified key runbooks already grep

Keys are validated at load: a value Kubernetes would reject fails -check-config instead of the first Acquire, hours later. Labels under byre.io/ and app.kubernetes.io/managed-by are reserved.

So the claim is answerable on its own:

kubectl -n hermes get sandboxclaims \
  -o custom-columns='CLAIM:.metadata.name,IDENT:.metadata.annotations.byre\.io/identity,PROFILE:.metadata.labels.sandbox\.users\.io/profile'
kubectl -n hermes get sandboxclaims -l sandbox.users.io/profile=eng

Getting it onto the pod

With provision: claims, byre creates a claim and the sandbox controller builds the pod from the SandboxTemplate. byre does not own the pod, so it cannot label it directly. The supported route is the claim's spec.additionalPodMetadata, which byre fills at claim creation and the controller merges into the pod. The template must not carry a constant identity label: a merge with a different value is rejected outright, and the same value for every pod is the defect this exists to remove.

The controller validates this field before it does anything else

A key it does not like does not lose that key — it fails the whole claim, Ready=False, reason=InvalidMetadata, and the identity gets no sandbox at all. Two rules, and they are not the same rule:

map rule error you get
labels every key must have a domain prefix, and that domain must be on the allowlist (default sandbox.users.io; subdomains pass) label "hermes.profile" must have a domain prefix or label domain "app.kubernetes.io" is not in the allowlist
annotations only a three-domain blocklist (kubernetes.io, k8s.io, agents.x-k8s.io) restricted system domain: …

So hermes.profile is a legal annotation and an illegal label. 0.8.5 shipped the label spelling; every new claim came back InvalidMetadata and the affected identity could not connect. byre now checks both maps in -check-config against the same defaults, so that config fails at rollout instead of taking the cluster down:

identities[2] (WcHWo47…): labels: "hermes.profile" has no domain prefix: the sandbox controller
rejects the whole claim (Ready=False, reason=InvalidMetadata) …; use sandbox.users.io/profile

The allowlist is read by the controller once at startup from agent-sandbox-config (allowed-label-domains). byre cannot read it, so if a cluster really does allow another domain, say so in both places:

# byre config
backends:
  - name: sandbox
    provision: claims
    provider:
      allowed_label_domains: ["sandbox.users.io", "example.com"]
kubectl -n agent-sandbox-system create configmap agent-sandbox-config \
  --from-literal=allowed-label-domains='sandbox.users.io,example.com'
kubectl -n agent-sandbox-system rollout restart deploy/agent-sandbox-controller

The value replaces the default rather than extending it, so keep sandbox.users.io in the list if anything else relies on it, and restart: the file is read once.

Verify with the pod, not the claim

kubectl -n hermes get sandboxclaims \
  -o custom-columns='CLAIM:.metadata.name,SANDBOX:.status.sandbox.name,READY:.status.conditions[0].status,IDENT:.metadata.annotations.byre\.io/identity'
kubectl -n hermes get pods -l 'app.kubernetes.io/part-of=hermes-sandbox' \
  -o custom-columns='POD:.metadata.name,PROFILE:.metadata.labels.sandbox\.users\.io/profile,ANNOT:.metadata.annotations.hermes\.profile'

Every pod that a claim owns should show its own identity, in the label and in the annotation. A pod that says default, sbx-eng, or any other constant has not been migrated. scripts/verify-sandbox-lease-and-labels.sh checks exactly that (check 3), starting from the claims: a claim with no pod, or a claim that is not Ready=True, is a failure, not an empty set that passes.

If the controller predates additionalPodMetadata

kubectl explain sandboxclaim.spec.additionalPodMetadata answers this without guessing: an empty result means the field is not in the installed CRD, and byre's claim will be rejected if it sends it. Delete the constant from the template anyway, and attribute in two hops:

# claim → sandbox
kubectl -n hermes get sandboxclaim -l sandbox.users.io/profile=eng \
  -o custom-columns='CLAIM:.metadata.name,SANDBOX:.status.sandbox.name,IDENT:.metadata.annotations.byre\.io/identity'
# sandbox → pod
kubectl -n hermes get pods -l agents.x-k8s.io/sandbox=<sandbox-name>

Also worth keeping: distinct pool pods are expected. lease.pool_size warm instances exist before any identity claims them, so several sandboxes with no identity is normal, and a warm pod must carry no profile label at all — it belongs to nobody. The defect was never the count, it was that a bound one could not be told from an unbound one.

What this does not solve

Identity on the object says who holds the instance. It says nothing about whether a client that reconnects got the same instance — see docs/lease-instance-identity.md for that question and why it is client work.