Kubernetes Multi-Tenancy & Hierarchical Namespaces Design Prompt
Design a soft multi-tenancy model on a shared Kubernetes cluster — tenant boundaries with hierarchical namespaces (HNC) or vCluster, propagated policy, isolation depth, and a clear threat model for what 'tenant' actually means.
- Target user
- Platform teams building an internal developer platform on shared clusters
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a platform architect who has run shared multi-tenant Kubernetes clusters and knows that "namespace == tenant" is a half-truth that leaks in five places. Tell me: - Who the tenants are (teams within one org, untrusted external customers, CI ephemeral envs) - Trust level between tenants and the blast radius you can tolerate - Current namespace/RBAC setup and whether you can mandate policies cluster-wide - Scale: number of tenants and namespaces, and growth Produce a tenancy design: 1. **Define the isolation contract** — soft (cooperative, same control plane) vs hard (untrusted, needs separate control plane / vCluster / separate clusters). Pick the right tier for the stated trust level and justify it; don't oversell namespace isolation as security. 2. **Namespace topology** — flat per-team vs Hierarchical Namespace Controller (HNC) with tenant roots and propagated child namespaces. Show how HNC propagates RBAC, NetworkPolicy, ResourceQuota, and LimitRange down a subtree, and the gotchas (object overwrite, exceptions). 3. **The five leak points** — and how to close each: (a) RBAC scope creep and cluster-scoped resources, (b) shared CRDs/operators, (c) NetworkPolicy default-deny + DNS, (d) node-level escape (PSA `restricted`, seccomp, no hostPath), (e) noisy-neighbor via ResourceQuota + priority classes. 4. **Per-tenant defaults** — the bundle every new tenant namespace gets: quota, limit range, default-deny NetworkPolicy, baseline RBAC roles, and a Kyverno/Gatekeeper guardrail set. 5. **When to graduate to hard isolation** — concrete signals (untrusted code, compliance boundary, kernel-level risk) and the migration path to vCluster or dedicated clusters. 6. **Self-service** — how a tenant requests a namespace (GitOps PR, operator) without a human granting cluster-admin. Output: (a) a decision matrix soft vs hard for my case, (b) the HNC tenant tree + propagated-policy manifests, (c) the per-tenant default bundle, (d) the leak-point checklist with the control for each, (e) graduation criteria to hard isolation.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Kubernetes User Namespaces Pod Isolation Design Prompt
Design and roll out user-namespaced pods (hostUsers: false) so container root maps to an unprivileged host UID — hardening against container-escape and CVE blast radius without breaking volumes or images.
-
Kubernetes Sandboxed Runtimes (gVisor / Kata) RuntimeClass Prompt
Stand up sandboxed container runtimes with RuntimeClass — pick gVisor vs Kata, wire containerd handlers, schedule workloads to sandbox-capable nodes, and quantify the syscall/perf trade-offs.
-
Kubernetes Stuck Terminating & Finalizer Debug Prompt
Diagnose and safely unstick namespaces, pods, and CRs frozen in Terminating — find the responsible finalizer or controller before reaching for the dangerous force-delete.
-
Helm Secrets + SOPS Encrypted Values Workflow Prompt
Design a GitOps-safe workflow for encrypting Helm values with the helm-secrets plugin and SOPS (age/KMS) — encrypted values in git, decryption at deploy time, key rotation, and CI wiring.
More Kubernetes & Helm prompts & error guides
Browse every Kubernetes & Helm prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.