What are Kubernetes resource quotas?

· Category: Kubernetes

Short answer

Resource Quotas limit the total amount of resources a namespace can consume. They restrict CPU, memory, storage, and object counts, ensuring fair resource sharing across teams.

How it works

A ResourceQuota object is created in a namespace. The API server rejects any request that would cause the namespace to exceed its quotas. Limits can be specified for requests, limits, and object counts.

Example

apiVersion: v1
kind: ResourceQuota
metadata:
  name: compute-quota
  namespace: dev
spec:
  hard:
    requests.cpu: "10"
    requests.memory: 20Gi
    limits.cpu: "20"
    limits.memory: 40Gi
    pods: "50"

Why it matters

Resource quotas prevent a single namespace from exhausting cluster resources. They are essential for multi-tenant environments and force teams to right-size their workloads.

Tips

  • Pair quotas with LimitRanges to enforce defaults per Pod.
  • Monitor quota usage with kubectl describe resourcequota.
  • Set quotas before onboarding teams to a shared cluster.

Common issues

  • Pods that do not specify requests or limits may fail if a LimitRange is missing.
  • Quotas block new objects, not running ones.
  • Storage quotas require the storage class to support them.