Namespaces are a Vault Enterprise feature that creates strong logical isolation inside a single cluster, letting you safely run multi-tenant workloads split by team, environment, or customer. Each namespace independently manages its auth methods, secrets engines, policies, entities/groups, and tokens.
In practice, the keys are which isolation mechanism you pick and how consistent your operations are. On exams, the X-Vault-Namespace header, token/policy scope, and replication and snapshot behavior are frequently tested. This article grounds the design axes and operational procedures in stable official specifications.
Namespaces are the logical tenant boundary in Vault Enterprise. Each namespace has its own policy evaluation, token issuance, auth methods, and secrets engines, so identical paths in different namespaces never collide. The API selects a namespace via the X-Vault-Namespace header, and the CLI uses the -namespace flag or the VAULT_NAMESPACE environment variable.
The classic operational and exam trap is whether you are actually operating on the namespace you intended. A missing header or environment variable can mount engines or apply policies in the wrong namespace. Remember that even a root token is scoped to the namespace where it was issued.
| Approach | Isolation Level | Operational Cost / Complexity | Exam Focus |
|---|---|---|---|
| Namespaces (single cluster) | Strong logical isolation (independent policies, auth, engines, tokens) | Medium: one cluster, but extra namespace management | X-Vault-Namespace, scope, preservation under replication |
| Path-only separation (single namespace) | Weak logical isolation (depends on policies) | Low: simple to manage but high misconfiguration risk | Path-level permission boundaries; large blast radius on misconfiguration |
| Physical cluster separation | Strongest (full isolation) | High: infrastructure, monitoring, and upgrades multiply | Per-cluster design for DR/Performance replication |
Namespace-based isolation inside a single cluster
Selecting a namespace via API and CLI (create, list)
# 1) Create team-a in the root namespace (API)
curl -sS \
-H "X-Vault-Token: $VAULT_TOKEN" \
-H "X-Vault-Namespace: root" \
-X POST $VAULT_ADDR/v1/sys/namespaces/team-a
# 2) List (the LIST method). The header is required
curl -sS -X LIST \
-H "X-Vault-Token: $VAULT_TOKEN" \
-H "X-Vault-Namespace: root" \
$VAULT_ADDR/v1/sys/namespaces | jq .
# 3) The CLI uses VAULT_NAMESPACE
export VAULT_NAMESPACE=team-a
auth_method=$(vault auth list -detailed -format=json | jq 'keys')Start from who needs to operate what independently. A common pattern places organizations or customers at the first level and environments (dev/stg/prod) at the second. Going deeper than 2-3 levels hurts both operations and visibility.
Adopt a consistent naming scheme (lowercase, hyphens, environment suffixes) and keep names short and collision-free. Park short-lived experiments under something like sandbox and review them on a regular cadence.
Listing namespaces and checking existence (API)
# List the first level under root
curl -sS -X LIST \
-H "X-Vault-Token: $VAULT_TOKEN" \
-H "X-Vault-Namespace: root" \
$VAULT_ADDR/v1/sys/namespaces | jq '.data.keys'
# List the environments under team-a
curl -sS -X LIST \
-H "X-Vault-Token: $VAULT_TOKEN" \
-H "X-Vault-Namespace: team-a" \
$VAULT_ADDR/v1/sys/namespaces | jq '.data.keys'ACL policies act on paths within the namespace being evaluated. Tokens are scoped to a namespace too, so a token issued in team-a cannot read team-b secrets. Even root-level privileges cannot reach outside their scope.
In practice, give each tenant a namespace-level admin role (e.g. ns-admin) and delegate policy registration, mounts, and entity management to it. Automate issuance and revocation per tenant so audits stay easy.
Creating a policy and issuing a token in team-a
# Name the namespace explicitly
export VAULT_NAMESPACE=team-a
# Register a least-privilege policy
echo '
path "kv/data/app/*" { capabilities = ["read"] }
' > read-app.hcl
vault policy write app-read read-app.hcl
# Issue a token carrying that policy
vault token create -policy=app-read -period=24h -orphanEach namespace can enable auth methods (userpass, OIDC, Kubernetes, GitHub, etc.) independently. Likewise, mount secrets engines like kv, pki, and database per tenant. Because path collisions are absorbed by the namespace, every tenant can use identical path conventions without interfering with one another.
TTLs, rotations, and role definitions are entirely namespace-local. Always make the target namespace explicit when performing standard operational tasks like creating roles, enabling engines, or tuning them.
Enabling auth and secrets engines per namespace
# Enable GitHub auth inside team-a
export VAULT_NAMESPACE=team-a
vault auth enable github
vault write auth/github/config organization=my-org
# Enable kv-v2 at the same path (team-a and team-b are independent)
vault secrets enable -path=kv -version=2 kv
export VAULT_NAMESPACE=team-b
vault secrets enable -path=kv -version=2 kvEnterprise DR/Performance replication replicates state including namespaces. Tenant boundaries survive failover, so your cutover plan should spell out which namespaces ride on which endpoints.
When using Integrated Storage (Raft), snapshots cover the whole cluster and include namespaces on both backup and restore. Take them during planned maintenance windows and rehearse restores periodically in non-production environments.
Snapshot operations (Integrated Storage)
# Take it (needs an appropriate admin token, usually from the root namespace)
vault operator raft snapshot save /backups/vault_$(date +%Y%m%d%H%M).snap
# Restore (in an isolated test environment with the cluster stopped)
vault operator raft snapshot restore /backups/vault_YYYYMMDDHHMM.snapCodifying namespaces, mounts, and policies with the Terraform Vault provider keeps configuration drift in check as tenant count grows. Pin the operating namespace with the provider's namespace argument and split tenants into separate workspaces for safety.
Enterprise quotas (such as rate limits) can be enforced per namespace. Define limits per tenant based on their SLAs to prevent noisy-neighbor problems.
Example: creating a namespace and rate limit with Terraform
# Terraform (vault >= 3.x)
provider "vault" {
address = var.vault_addr
token = var.vault_token
namespace = "root"
}
resource "vault_namespace" "team_a" {
path = "team-a"
}
# Mount kv inside team-a (scoped with a different provider)
provider "vault" {
alias = "team_a"
address = var.vault_addr
token = var.vault_token
namespace = "team-a"
}
resource "vault_mount" "kv" {
provider = vault.team_a
path = "kv"
type = "kv-v2"
}
# Quota (API example): 100 requests per second for team-a
curl -sS -X POST \
-H "X-Vault-Token: $VAULT_TOKEN" \
-H "X-Vault-Namespace: root" \
-H "Content-Type: application/json" \
$VAULT_ADDR/v1/sys/quotas/rate-limit/team-a-rl \
-d '{
"rate": 100,
"interval": "1s",
"namespace": "team-a"
}'Ops
Question 1
While operating Vault Enterprise with Namespaces, an operator believed they were creating a new kv-v2 mount under team-a/prod, but it actually ended up in the root namespace. What is the most likely cause?
Correct answer: A
When you omit the namespace specification in the API or CLI, the operation targets the current namespace. kv-v2 is not auto-shared across namespaces, and replication does not promote mounts. A root token is also scoped to the namespace where it was issued.
Are Namespaces available in OSS Vault?
No. Namespaces are a Vault Enterprise feature. With OSS Vault, your options are path-based separation or running separate clusters.
Can secrets be referenced across namespaces?
Not directly. Each namespace has its own policy and token boundary, so cross-namespace lookups are not supported by design. If you need shared access, add a federation layer in the application, or place a shared mount in a higher-level namespace common to the tenants.
Can backups be taken per namespace?
Integrated Storage snapshots cover the entire cluster. Partial restore at the namespace level is not supported, so design recovery around the whole cluster and enforce tenant isolation through cutover plans and automated tests.
Practice with certification-focused question sets
Try free questionsNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)
Vault fundamentals — sealed/unsealed state, auth methods, se...
Vault Operations Professional (VOP-003): Complete Guide (2026)
Pass the Vault Operations Professional exam — enterprise pat...
Vault Path-Based Routing: API URL Structure (2026)
How Vault's path-based routing works — mount points, sub-pat...
Vault Tokens: Auth Token Mechanics (2026)
Token fundamentals — service vs. batch tokens, accessor, ren...
Vault Token Types: Service, Batch, Periodic (2026)
Service vs. batch tokens compared — performance, ACL behavio...