Skip to content
Latchkey

nomad namespace: Isolate Nomad Jobs in CI

nomad namespace manages namespaces, the logical partitions that isolate jobs, allocations, and variables within a Nomad cluster.

Namespaces keep teams or environments apart in one cluster. A per-PR or per-team namespace scopes jobs and the ACLs that can touch them.

What it does

nomad namespace groups the namespace subcommands. namespace apply creates or updates a namespace, namespace list shows them all, namespace status details one, and namespace delete removes an empty one. Jobs, variables, and ACL policies are all scoped by namespace.

Common usage

Terminal
nomad namespace apply -description="team web" web
nomad namespace list
nomad namespace status web
# target a namespace for a command
nomad job status -namespace=web
export NOMAD_NAMESPACE=web

Options

Subcommand / flagWhat it does
apply <name>Create or update a namespace
listList all namespaces
status <name>Show a namespaces details
delete <name>Delete a namespace (must be empty)
-description <text>Set a description on apply
-namespace <ns> / NOMAD_NAMESPACEScope other commands to a namespace

In CI

Give each ephemeral environment its own namespace so a teardown can nomad job stop -purge everything in it without touching other work. Set NOMAD_NAMESPACE once in the job environment instead of repeating -namespace on every command.

Common errors in CI

"Namespace \"web\" not found" means you queried a namespace that does not exist; create it with apply or fix NOMAD_NAMESPACE. "Permission denied" means the token lacks access to that namespace. "delete failed: Namespace ... has non-terminal jobs" means you must stop and purge its jobs before deleting it.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →