Kubernetes Namespace & ResourceQuota Builder

Generate namespace, quota, and limit range YAML for a K8s team environment

Build a Kubernetes Namespace with a matching ResourceQuota (CPU, memory, pod caps) and a LimitRange of per-container defaults — the standard primitives for safe multi-tenant clusters. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is a Kubernetes namespace for?

A namespace is a virtual cluster that isolates resources for a team, environment, or application. Names only need to be unique within a namespace, and you can attach quotas, network policies, and RBAC rules per namespace for multi-tenancy.

Stand up a safe multi-tenant namespace

When several teams share a cluster, an unbounded namespace can starve everyone else by scheduling too many pods or oversized containers. This builder generates the three objects that fence off a namespace: the Namespace itself, a ResourceQuota capping aggregate usage, and a LimitRange providing sensible per-container defaults.

How it works

The ResourceQuota sets hard ceilings on the sum of requests.cpu, requests.memory, limits.cpu, limits.memory, and the pod count across the whole namespace. Kubernetes enforces these at admission time — any request that would push the namespace over a cap is rejected.

A quota that limits limits.cpu/limits.memory forces every container to declare those values. The LimitRange fills the gap: it injects default and defaultRequest values into containers that omit them, and sets per-container max ceilings. Together they guarantee that every workload is accounted for and the quota math always has the numbers it needs.

The three generated objects and why you need all three

Namespace is the isolation boundary. Resources in one namespace cannot directly reference resources in another without explicit configuration. The namespace also carries labels for RBAC, network policies, and cost attribution.

ResourceQuota enforces aggregate limits across the whole namespace. Without it, a single team can schedule unlimited pods and consume all cluster resources, degrading every other tenant. The quota is the namespace’s budget.

LimitRange enforces per-container limits and provides defaults. Without it, any container that omits resource declarations will trigger a quota admission error once the quota is enforced — because Kubernetes has no number to add to the quota total. The LimitRange supplies those defaults silently, so developers who forget to set resources still get sensible values and admission succeeds.

Choosing quota values

There is no universal right answer for quota sizes, but a few starting heuristics:

Namespace typeSuggested CPU quotaSuggested memory quota
Small dev team (2–5 devs)4 cores total8Gi total
Medium product team (5–15 devs)16 cores total32Gi total
Production workloadSized to peak load + 30% headroom
Staging / testHalf of production quota

The pod count limit prevents runaway deployments or job floods. A typical team namespace might cap at 50–100 pods; a large production namespace may not need a pod count limit if the resource quota is tight enough.

Tips for applying

  • Keep defaultRequest modest — it is the floor each container reserves and counts against the quota even when idle.
  • Set the LimitRange max to your largest sane container so a single workload cannot consume the entire namespace quota by itself.
  • Add a team label to the namespace for cost attribution and to target it with network policies or RBAC bindings.
  • Apply all three documents together in one command; the LimitRange should exist before any workloads are deployed so defaults take effect from the first pod.
kubectl apply -f namespace-with-quota.yaml
kubectl describe resourcequota -n <namespace>