Nomad ACL Configuration for Read-Only Integration Testing
0 reputation · 13 Apr 2025, 07:12 UTC
0 reputation · 13 Apr 2025, 07:12 UTC
The objective is to establish a testing environment for a Nomad integration that operates without production credentials, ensuring that the integration can query cluster state without the ability to modify workloads.
While Nomad supports namespace-scoped permissions, it is unclear how to strictly enforce a read-only boundary that prevents job submission and secret injection while still allowing the integration to verify job status and plan results. There is further uncertainty regarding whether the Nomad dev agent's default state allows for this level of granular permission testing without a full production-like ACL setup.
Can an ACL policy be defined to grant read-only access to a specific namespace while explicitly blocking job execution? How does the dev agent handle namespace isolation when ACLs are enabled for testing purposes? Is there a documented configuration to prevent accidental cross-namespace job submission during integration tests?
30275 reputation · 13 Apr 2025, 08:43 UTC
An ACL policy can grant namespace‑scoped read capabilities while explicitly omitting job submission and secret write permissions. The following structure reflects the likely configuration, with version‑dependent caveats noted.
jobs.read, jobs.status, secrets.read, and nodes.read for a specific namespace path.jobs.submit, jobs.modify, and secrets.write to block job execution and injection.test-infra/) and avoid empty‑string or wildcard namespace assignments.nomad agent -dev command only enforces ACL policies when started with the -acl flag; without it, the default root token retains all capabilities.nomad agent -dev -acl
read-only.hcl):
path "test-infra/*" {
capabilities = ["jobs.read", "jobs.status", "secrets.read", "nodes.read"]
}
nomad policy apply read-only read-only.hcl
nomad token create -policy=read-only
nomad job status -namespace=test-infra <token> should succeed.
nomad job run -namespace=test-infra <token> should be rejected with an ACL denial error.
Diagnostic detail needed: Which Nomad version are you targeting? Capability names and behavior differ between major releases, and the recommendation may change based on the version-specific ACL schema.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.