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
- Enable Consul ACLs with a restrictive anonymous token (no service:write)
- Configure a Consul auth method (e.g., nomad-workloads) for Nomad Workload Identity
- 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
- Deploy jobs using Consul Connect service mesh. Allocations receive proper WI-derived Consul tokens and sidecars work correctly
- Restart the VM
- Nomad recovers allocations from client state. Envoy sidecars fail with Permission denied: anonymous token lacks permission 'service:write'
- 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}
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
/opt/nomad/data/allocand/opt/nomad/data/client/stateExpected 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