Skip to main content
K8sCalc

kubernetes

Kubernetes Resource Quota Calculator

Calculate namespace ResourceQuota values for your Kubernetes cluster. Set CPU and memory limits per namespace based on team size, pod count, and a safety buffer.

Kubernetes Resource Quotas for Multi-Team Clusters

ResourceQuota prevents any single team or workload from consuming all cluster resources. It's essential in shared Kubernetes clusters.

ResourceQuota YAML

yaml
apiVersion: v1
kind: ResourceQuota
metadata:
  name: team-quota
  namespace: team-alpha
spec:
  hard:
    requests.cpu: "5"          # from calculator
    requests.memory: "10Gi"    # from calculator
    limits.cpu: "10"
    limits.memory: "20Gi"
    count/pods: "20"
    count/services: "10"
    count/persistentvolumeclaims: "5"

LimitRange for Defaults

yaml
apiVersion: v1
kind: LimitRange
metadata:
  name: default-limits
  namespace: team-alpha
spec:
  limits:
    - type: Container
      default:
        cpu: 500m
        memory: 256Mi
      defaultRequest:
        cpu: 100m
        memory: 128Mi
      max:
        cpu: "4"
        memory: 8Gi

Multi-Namespace Strategy

Team TypeBufferQuota Strategy
Production20–30%Quota on requests + limits
Staging10–20%Quota on requests only
Development30–50%Loose quota + LimitRange defaults

Monitoring Quota Usage

bash
kubectl describe resourcequota -n team-alpha
kubectl get resourcequota --all-namespaces

Frequently Asked Questions

What is a ResourceQuota and why use one?

A ResourceQuota caps the total CPU, memory, and object counts that can be consumed by all Pods in a namespace. Without quotas in a multi-team cluster, one team's runaway job can starve other teams of resources. Quotas enforce fair sharing and prevent accidental resource exhaustion.

Should I set requests or limits in ResourceQuota?

Always quota requests (requests.cpu, requests.memory) rather than limits. Limits are optional on Pods and hard to predict. Quotas on requests give a fair representation of reserved capacity. If you also quota limits, every Pod must have a limit set — this enforces LimitRange usage.

What happens when a namespace hits its quota?

New Pod creations fail with a 403 'exceeded quota' error. Running Pods are not evicted — only new scheduling is blocked. This is why the burst buffer matters: without it, a legitimate scaling event will fail. Set the buffer to at least your HPA max-replicas overhead.

How do ResourceQuota and LimitRange work together?

ResourceQuota caps total namespace usage. LimitRange sets default and maximum request/limit per individual Pod. Together: LimitRange ensures every Pod has sensible defaults (so Pods without explicit requests count against the quota), while ResourceQuota caps the namespace total. Use both in production multi-tenant clusters.

Related Tools

Related Guides