Skip to content

Allocation recovery does not re-derive Consul tokens via Workload Identity, falling back to anonymous token #27824

@Diogo-Almeida3

Description

@Diogo-Almeida3

Nomad version

Nomad v1.11.1

Operating system and Environment details

Azure VM with ubuntu 24.04

Issue

When a Nomad client restarts and recovers allocations from its saved state, the Consul hook that exchanges Workload identity JWTs for Consul ACL tokens is not re-executed. The recovered Envoy sidecars start with an invalid/missing Consul token and fall back to the anonymous token, resulting in Permission denied: anonymous token lacks permission 'service:write'. Manually rescheduling allocations resolves the issue because new allocations go through the full hook lifecycle and obtain fresh Consul tokens. The recovery path should re-derive Consul WI tokens the same way the new allocation path does.

Reproduction steps

  1. Enable Consul ACLs with a restrictive anonymous token (no service:write)
  2. Configure a Consul auth method (e.g., nomad-workloads) for Nomad Workload Identity
  3. Configure Nomad with service_auth_method and task_auth_method pointing to the auth method, and a Consul token in a separate .hcl for agent-level communication
  4. Deploy jobs using Consul Connect service mesh. Allocations receive proper WI-derived Consul tokens and sidecars work correctly
  5. Restart the VM
  6. Nomad recovers allocations from client state. Envoy sidecars fail with Permission denied: anonymous token lacks permission 'service:write'
  7. Running nomad job restart -reschedule for the affected jobs resolves the issue, confirming that fresh allocations correctly obtain Consul tokens or deleting the data in /opt/nomad/data/alloc and /opt/nomad/data/client/state

Expected Result

Recovered allocations re-derive Consul tokens via the WI auth method.

Actual Result

Recovered allocations skip the Consul WI token exchange and fall back to the anonymous token.

Sidecar log

DeltaAggregatedResources gRPC config stream to local_agent closed: 7, Permission denied: anonymous token lacks permission 'service:write' on "". The anonymous token is used implicitly when a request does not specify a token.{via_upstream}

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Triaging

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions