Resource Quotas in Kubernetes: Fair Shares for Everyone Who Shares a Cluster

Resource Quotas in Kubernetes: Fair Shares for Everyone Who Shares a Cluster

A beginner-friendly, ground-up guide to how Kubernetes stops one team from eating the whole cluster: what resource quotas are, what they count, how they are enforced, and how to design limits that are fair, safe and easy to live with.

Imagine a large shared office kitchen with one fridge, one kettle and one set of plates. If nobody sets any rules, one enthusiastic team might fill the entire fridge with their lunches, leaving nothing for anyone else. Arguments follow, and soon the whole floor is unhappy. A simple rule such as “each team gets one shelf” solves the problem without anyone needing to police the kitchen.

A Kubernetes cluster is that shared kitchen, and a resource quota is the shelf rule. It puts a firm ceiling on how much of the cluster each team, project or environment may use. This guide starts from the very beginning and builds up to the point where you can design, read and troubleshoot quotas with confidence.

1The Problem of Sharing

Before meeting quotas, we need to understand why a shared cluster can go wrong.

One cluster, many teams

Running a separate cluster for every team is expensive and hard to manage. Most companies therefore let many teams share one cluster, giving each its own section called a namespace. This is efficient, because the computers are used fully rather than sitting idle in separate silos.

The catch is that Kubernetes, by default, does not limit how much any one namespace may use. If a team asks for a hundred copies of a heavy application, the cluster will happily try to provide them, even if that leaves nothing for anyone else.

Simple Analogy

Think of a block of flats sharing one water tank. If one flat leaves every tap running, the tank empties and the whole building goes dry. A limit on each flat’s usage protects every neighbour, even the ones who never do anything wrong.

Three common ways things go wrong

The Runaway Mistake

A developer makes a typing error and asks for a thousand copies instead of ten. Without a limit, the cluster tries to start them all, starving other teams and possibly triggering a huge cloud bill.

The Noisy Neighbour

One team’s application is greedy with memory and processor power. Applications from other teams, sharing the same computers, slow down or are evicted because there is not enough left.

The Clutter Problem

Over months, a team creates thousands of small objects, such as settings and secrets. The cluster’s central database grows heavier, slowing down everything for everyone.

i
Helpful Note

Resource quotas solve all three problems with a single idea: a ceiling per namespace. Each team is free to use resources as they like, but only up to their own limit.

2Kubernetes in Five Minutes

A quick tour of the building blocks that quotas talk about.

Building Block 1

Cluster

The whole group of computers that Kubernetes manages together as one system.

Building Block 2

Node

One computer inside the cluster that runs containers. It has a fixed amount of processor and memory.

Building Block 3

Pod

The smallest runnable unit. It wraps one or more containers that work together.

Building Block 4

Namespace

A named section of the cluster used to separate teams, projects or environments. Quotas are attached to namespaces.

Building Block 5

Scheduler

The component that decides which node each new pod should run on, based on free room.

Building Block 6

API Server

The front desk of the cluster. Every request to create or change anything goes through it, including quota checks.

The important idea is that the namespace is the natural boundary for sharing. Each team or project lives in its own namespace, and the quota is the limit attached to that boundary.

Simple Analogy

Picture a shopping mall again. The mall is the cluster, each shop is a node with limited floor space, and each department floor is a namespace. The mall management gives each floor a maximum share of the electricity and storage rooms. That maximum is the quota.

3A Primer on Requests and Limits

Quotas count two numbers that every container can declare. You need to know them first.

Requests

A request is the amount of processor power and memory a container asks for as its normal need. The scheduler uses requests to decide where to place a pod. If a node does not have that much unclaimed room, the pod is placed elsewhere or waits. A request is a promise the cluster makes to the container.

Limits

A limit is the maximum a container is allowed to use. If it tries to use more processor power than its limit, it is slowed down. If it tries to use more memory than its limit, it is stopped. A limit is a ceiling the container must respect.

IdeaWhat it meansWho uses itEveryday picture
RequestThe amount the container normally needs and is guaranteedThe scheduler, when choosing a nodeReserving a table for four at a restaurant
LimitThe most the container may ever useThe node, when enforcing behaviourThe restaurant’s rule of no more than six at a table
Simple Analogy

Booking a hotel room is a request: you are guaranteed a room. The maximum number of guests the room may hold is the limit. A hotel manager cares about both, because rooms cannot be over-booked, and rooms cannot be overcrowded.

!
Why This Matters for Quotas

A quota can limit the total of all requests in a namespace, the total of all limits, or both. Because of this, containers in a namespace with such a quota must declare their requests and limits, or the cluster will refuse to create them. We will see why shortly.

4So, What Is a Resource Quota?

A plain definition, and what makes it special.

The definition

A resource quota is a Kubernetes object that sets a combined limit on how much a whole namespace may consume. It can cap the total processor power and memory, the total storage, and the number of objects such as pods, services and secrets. Once the namespace reaches its limit, any request to create more is refused.

What makes it special

It Works on Totals

A quota does not limit any single pod. It limits the sum across the entire namespace. A namespace with a quota of twenty processor cores could run one huge application or two hundred tiny ones, as long as the total stays under twenty.

It Is Enforced at the Front Door

The check happens when someone tries to create or change something. If the change would push the total past the limit, the API server says no immediately, with a clear message. Nothing is started and nothing is half-created.

It Belongs to a Namespace

Each quota applies to exactly one namespace. Different namespaces can have different quotas, letting you give a large team a generous share and a small experiment a modest one.

Per namespace
Each quota covers one namespace only
Totals
Limits the sum, not individual pods
At creation
Checked when objects are created or changed
Simple Analogy

A household budget works the same way. You do not limit each purchase, but you set a monthly total. Buy a few expensive things or many cheap ones, the shop simply stops serving you once the month’s total is reached.

5What a Quota Can Count

Quotas fall into three broad families, depending on what they limit.

Family 1

Compute Quotas

Cap the total processor and memory that pods in the namespace may request, and the total they may be allowed to use as limits.

Family 2

Storage Quotas

Cap the total storage that can be requested, the number of storage claims, and even the amount per storage class.

Family 3

Object Count Quotas

Cap how many objects of a given kind may exist, such as pods, services, secrets and settings objects.

Special

Extended Resources

Cap scarce special hardware such as graphics processors, counted through requests.

Compute quotas in detail

Compute quotas are the most common. You can limit the total of requested processor power, the total of requested memory, the total of processor limits and the total of memory limits. Some clusters also limit temporary disk space used by pods. Together, these stop a namespace from claiming an unfair share of the machines.

Storage quotas in detail

Storage quotas limit how much persistent disk space a namespace may request in total, and how many storage claims it may create. Administrators can go further and set different limits for each storage class, for example allowing plenty of standard storage but very little of the expensive fast kind.

Object count quotas in detail

Object counts protect the cluster’s central database and its network resources. You can limit the number of pods, services, secrets and settings objects. You can even limit special kinds of services that create costly cloud load balancers, or that reserve a port on every node.

What is limitedFamilyWhy it is useful
Total requested processor and memoryComputeStops a team from reserving too much of the cluster
Total processor and memory limitsComputeControls the worst-case demand on nodes
Total requested storageStorageControls disk cost and capacity
Number of storage claimsStoragePrevents thousands of tiny disks
Storage per storage classStorageKeeps expensive tiers under control
Number of podsObject countPrevents accidental floods of pods
Number of load balancer servicesObject countAvoids surprise cloud bills
Number of secrets and settings objectsObject countProtects the cluster database from clutter
Graphics processors requestedExtended resourceShares scarce, costly hardware fairly
i
Helpful Note

You do not need to limit everything. Most teams start with compute totals, storage totals and a handful of object counts, and add more only when they see a real problem.

6Internal Working: How Quotas Are Enforced

Let us follow one request to create a pod through the quota check.

Step one: the request arrives

Someone, or some controller, asks the API server to create a pod in a namespace. The server checks who is asking and whether they have permission. If so, the request continues to a stage called admission, where a series of checks and adjustments happen before anything is stored.

Step two: the quota check

One of the admission steps is the quota check. The server looks up the quota objects in that namespace, reads how much has already been used, and adds what the new pod would need. If the sum stays within every limit, the request passes. If any limit would be exceeded, the request is rejected at once with a message saying which limit was hit.

Step three: usage is recorded

When a request is accepted, the server updates the recorded usage of the quota. A background controller also recalculates usage regularly, to fix any drift, and to account for resources being deleted or finishing their work.

sequenceDiagram
    participant U as User or Controller
    participant API as API Server
    participant Q as Quota check in admission
    participant DB as Cluster database
    U->>API: Create a pod in a namespace
    API->>API: Authenticate and authorise
    API->>Q: Would this fit within the namespace quota?
    Q->>Q: Current usage plus new request compared with limits
    alt Within all limits
        Q-->>API: Allowed
        API->>DB: Store pod and update recorded usage
        API-->>U: Created
    else Any limit exceeded
        Q-->>API: Denied
        API-->>U: Forbidden, exceeded quota
    end
        
FIG 1 — The quota check during admission
Simple Analogy

Think of a cinema box office. Each screening has a fixed number of seats. Every time someone buys tickets, the clerk checks the seats already sold, adds the new request, and either hands over the tickets or says the show is full. The check happens at the counter, before anyone walks in.

!
Important Detail

Quota checks happen when things are created or changed. If you lower a quota below the current usage, nothing running is removed. The existing pods keep running, but no new ones can be added until usage falls below the new limit.

7What Happens When the Quota Is Exceeded

The behaviour differs depending on who is creating the object, and this surprises many beginners.

Creating a pod directly

If a person creates a pod directly and the quota is exceeded, the command fails on the spot with a clear “forbidden” message naming the exceeded quota. This is easy to see and understand.

Creating through a Deployment

Most applications are created through a Deployment. The Deployment itself is accepted, because a Deployment is only a description, and does not count as a pod. The trouble appears later, when the Deployment’s helper, the ReplicaSet, tries to create the pods and the quota check rejects them. The Deployment exists, but fewer pods than expected are running, and the reason appears only in the events of the ReplicaSet.

flowchart TD
    A["Create a Deployment"] --> B["Deployment accepted and stored"]
    B --> C["ReplicaSet tries to create pods"]
    C --> D{"Quota check"}
    D -- "Within limits" --> E["Pods created and running"]
    D -- "Exceeded" --> F["Pod creation refused"]
    F --> G["Deployment shows fewer ready pods"]
    G --> H["Reason appears in ReplicaSet events"]
        
FIG 2 — Why a quota problem can look like a silent failure
!
Common Mistake

Beginners see a Deployment that is stuck at fewer pods than requested, and look at the pods for clues. But no pods exist to look at. The clue is in the events of the ReplicaSet, or in the quota’s own usage report. When pods are mysteriously missing, always check the quota.

The declared-requests rule

If a namespace has a quota on requests or limits, then every new pod must state its own requests and limits. A pod that says nothing is refused, because the quota cannot count what is not declared. This rule surprises many teams the first time a quota is applied to an existing namespace.

Simple Analogy

Imagine a conference hall where each company has a fixed number of seats. If a company sends people without telling the organiser how many are coming, the organiser cannot count and refuses entry. Everyone must declare their party size at the door.

8The Companion: LimitRange

A quota limits the namespace as a whole. A limit range shapes the individual containers inside it.

A limit range is another namespace-level object. Where a quota sets a ceiling on totals, a limit range sets rules for each individual pod or container. It can set minimum and maximum sizes, and it can supply default requests and limits for containers that do not declare their own.

Job 1

Default Values

If a container declares nothing, the limit range fills in sensible defaults, so it is not refused by the quota.

Job 2

Maximum Size

Stops any single container from being enormous and swallowing most of the namespace’s quota alone.

Job 3

Minimum Size

Prevents tiny, unrealistic requests that would let a team squeeze in far too many pods.

Job 4

Ratio Control

Limits how far a container’s ceiling may be above its request, keeping demand predictable.

AspectResource QuotaLimit Range
What it controlsTotal use across the namespaceSize of each pod or container
LevelWhole namespaceIndividual object
Can provide defaultsNoYes
Stops one giant containerOnly indirectlyYes, through maximums
Best usedTo cap total consumptionTo make each object reasonable
i
Helpful Note

The two objects are best used together. The limit range makes every container declare sensible sizes, and the quota makes sure the sizes never add up to more than the namespace’s share.

Simple Analogy

A family sets a monthly budget for the household, which is the quota. It also decides that no single purchase over a certain amount is allowed without discussion, which is the limit range. The budget protects the total, and the rule protects against one extravagant item.

9Quota Scopes: Counting Only Some Pods

Sometimes you want a quota to apply only to certain kinds of pods. Scopes make that possible.

A scope narrows a quota so that it counts only the pods matching a certain condition. This lets you build several quotas in one namespace, each governing a different category of workload.

Terminating and Not Terminating

Some pods run for a limited time, such as batch jobs with a deadline. Others run indefinitely, such as web servers. These two scopes let you give short-lived jobs their own budget, separate from long-running services.

Best Effort and Not Best Effort

Best effort pods declare no requests or limits at all. A quota with this scope can only cap how many such pods exist. It is a way to keep the number of unguaranteed pods small.

Priority Class

Pods can be given a priority. A quota scoped by priority lets you reserve a limited amount of capacity for high-priority pods, and prevents teams from labelling everything as urgent.

Cross Namespace Affinity

Some advanced pod placement rules can refer to pods in other namespaces. A scope exists to restrict which namespaces are allowed to use them, protecting others from being influenced.

flowchart LR
    NS["One namespace"] --> Q1["Quota A: long-running services"]
    NS --> Q2["Quota B: short-lived batch jobs"]
    NS --> Q3["Quota C: high-priority pods"]
    Q1 --> R1["Counts only matching pods"]
    Q2 --> R2["Counts only matching pods"]
    Q3 --> R3["Counts only matching pods"]
        
FIG 3 — Several scoped quotas in one namespace
!
Important Detail

When a namespace has several quotas, a request must satisfy all of them. The strictest quota decides. A single request that fits nine quotas but breaks the tenth is still refused.

10A Ceiling, Not a Reservation

One of the most misunderstood facts about quotas.

A quota says “this namespace may use up to this much”. It does not say “this namespace will always have this much available”. Quotas are ceilings, not reservations. The cluster still has a finite amount of real capacity, and quotas do not create more.

In fact, the sum of all namespace quotas is often larger than the cluster’s real capacity, on purpose. Administrators assume that not all teams will use their full share at the same moment, so they allow the total of the ceilings to exceed the real capacity. This is called overcommitting, and it is the reason a pod can be refused by the scheduler even when the namespace is well within its quota.

flowchart TD
    A["Pod creation request"] --> B{"Quota check: within namespace ceiling?"}
    B -- "No" --> X["Refused by quota"]
    B -- "Yes" --> C["Pod accepted"]
    C --> D{"Scheduler: is there real free room on a node?"}
    D -- "No" --> W["Pod waits as pending"]
    D -- "Yes" --> R["Pod runs"]
        
FIG 4 — Quota and scheduler are two separate gates
Simple Analogy

An airline may allow every passenger to check in a certain baggage weight, which is like a quota. But it sells more seats than the hold can carry at full weight, assuming most passengers travel light. Quota tells you what is permitted. It does not guarantee the hold has room.

i
Two Gates, Two Messages

If a pod is forbidden, the quota said no. If a pod is pending, the quota said yes, but the scheduler found no node with enough real room. The fix for each is very different: raise the quota for the first, add capacity for the second.

11The Life of a Quota

Quotas are set up, watched, adjusted and eventually retired. Good teams plan each stage.

1

Sizing

The platform team estimates fair shares for each team, using real usage data, budget and business importance as guides.

2

Creation

The namespace is created together with its quota and its limit range, ideally through automation so every namespace starts the same way.

3

Enforcement

Every create or change request in the namespace is checked against the quota, and usage is recorded continuously.

4

Observation

Teams and platform staff watch used versus allowed amounts, and alert when a namespace approaches its ceiling.

5

Review and Adjustment

When a team grows or shrinks, or a request for more is justified, the quota is raised or lowered through a normal reviewed change.

6

Retirement

When the namespace is no longer needed, it is deleted along with its quota, and its share returns to the pool.

Many organisations do the first three stages well and forget the last three. Over time, quotas set years ago no longer match reality: some are far too large and waste capacity, others are too small and quietly slow teams down.

12Designing Quotas That Work in Real Life

Choosing numbers is part science and part conversation.

Start from real usage

The best starting point is what teams actually use today. Look at their current totals of requests and limits, add reasonable headroom for growth and spikes, and use that as the first quota. Guessing without data leads to quotas that are either uselessly large or painfully small.

Leave room for rolling updates

When an application is updated, Kubernetes often starts new pods before stopping old ones. During that period, the namespace briefly uses more resources than usual. A quota set exactly at the steady-state usage will block updates. Always leave headroom, often thirty to fifty percent, for such surges.

Use tiers instead of custom numbers

Rather than inventing a unique quota for every team, offer a small menu of sizes. It makes requests simpler, keeps the platform easy to manage and makes fairness easier to explain.

TierIntended forCompute ceilingStorage and objects
SandboxLearning and short experimentsVery smallMinimal storage, few objects, no load balancers
SmallSingle small application in developmentModestSmall storage, limited object counts
StandardA typical team’s testing environmentModerateComfortable storage, a couple of load balancers
ProductionCustomer-facing servicesGenerous, with headroom for updatesLarger storage, higher counts, priority capacity
!
Common Mistake

Setting a production quota tightly to the current usage may seem economical, but it blocks scaling during a traffic spike, which is exactly when you need it most. A quota that stops your application from growing during an emergency is worse than no quota.

Simple Analogy

Think of a mobile phone plan. Choosing a plan with exactly the data you used last month means you run out the moment you watch one extra video. A sensible plan includes some headroom, and a tier menu makes it easy to pick one.

13Security and Governance

Quotas are not just about fairness. They are also a safety mechanism.

Defence against runaway or malicious usage

If an attacker gains access to one namespace, they may try to launch huge numbers of pods, for example to mine cryptocurrency at your expense. A quota puts a hard ceiling on the damage they can do from that namespace. It is not a full defence, but it limits the blast radius and the bill.

Protecting the control plane

Object count quotas protect the cluster’s central database and the API server from being flooded. Limiting the number of settings objects, secrets and pods per namespace stops any single team from slowing the control plane for everyone.

Who may change quotas

If teams can edit their own quotas, the quotas mean nothing. Only platform administrators should be allowed to create, edit or delete quota objects. Role-based access control handles this: ordinary users receive read access to see their usage but no permission to change it.

Guarding against quota bypass

A team that can create new namespaces freely can simply make another namespace with its own fresh quota. Restrict namespace creation to administrators or an automated process that assigns a quota to every new namespace, so nobody escapes the rules by moving house.

flowchart TD
    A["Administrators own quota objects"] --> B["Namespaces created only through a controlled process"]
    B --> C["Every namespace receives a quota and a limit range"]
    C --> D["Teams have read-only access to quota status"]
    D --> E["Alerts warn when usage nears the ceiling"]
    E --> F["Changes to quotas are reviewed and audited"]
        
FIG 5 — Governance layers around quotas
!
Real Danger

A namespace without any quota is a namespace without any ceiling. If a single forgotten namespace has no limits, it can consume the whole cluster. Make sure that every namespace, including ones for testing and tooling, has a quota.

14Monitoring, Alerting and Troubleshooting

A quota that nobody watches is a trap waiting to spring.

Reading the quota’s own report

Every quota records two sets of numbers: the hard limits that were set, and the amounts currently used. Describing the quota object shows both side by side, which makes it easy to see which resource is close to its ceiling.

What to watch

Signal 1

Usage Above Eighty Percent

A namespace nearing its ceiling deserves an early warning, so teams can ask for more before they are blocked.

Signal 2

Repeated Forbidden Errors

A stream of quota rejections in the audit log or events indicates a namespace that is being throttled and needs attention.

Signal 3

Deployments Below Desired Count

When a Deployment cannot reach its desired number of pods, check quota events before looking for deeper causes.

Signal 4

Consistently Low Usage

A quota that is barely touched is wasted allocation. Reviewing and shrinking it frees capacity for others.

Common problems and their usual causes

SymptomLikely causeWhat to check
Pod creation is forbidden with an exceeded quota messageNamespace has reached a compute, storage or count limitUsed and hard values in the quota report
Pod refused because requests or limits are missingQuota exists on those values, but the pod declares nonePod description, and whether a limit range provides defaults
Deployment stuck below desired pods with no pods to inspectReplicaSet cannot create pods because of quotaReplicaSet events and quota status
Rolling update stallsNo headroom for the temporary extra podsCompute headroom during updates
Pod pending although quota has roomScheduler cannot find free real capacityNode capacity, not the quota
Quota edit seems to have no effect on existing podsQuotas are checked only at creation and changeExisting usage versus the new limit
i
Helpful Note

Kubernetes usually explains a rejection in plain words, naming the quota, the resource and the amounts requested, used and limited. Reading that message carefully solves most quota problems in a minute.

15Design Patterns and Anti-Patterns

Patterns are proven habits. Anti-patterns are popular mistakes that keep costing teams.

Patterns worth adopting

Every Namespace Born with a Quota and a Limit Range

Use automation so that no namespace can exist without both. Nobody has to remember, and no forgotten namespace becomes a loophole.

A Small Menu of Quota Tiers

Offer a handful of standard sizes. Teams choose a tier, and moving between tiers is a simple, reviewed change.

Headroom for Updates and Spikes

Size quotas above steady-state usage so that rolling updates and traffic surges are never blocked by the quota itself.

Early Warning Alerts

Alert teams and platform staff when usage passes a threshold such as eighty percent, so limits are raised by conversation, not by emergency.

Quotas as Code

Keep quota definitions in version control alongside other descriptions. Every change has a reviewer, a reason and a history.

Anti-patterns to avoid

ANTI-PATTERN-01 Avoid
Problem

Some namespaces have no quota at all, because they were created by hand for a quick test and never reviewed.

Why It’s Harmful

A single unlimited namespace can consume the cluster’s capacity, whether through a mistake or an attack, and harm every other team.

Correct Approach

Create namespaces only through a controlled process that always attaches a quota and a limit range, and audit for any exceptions.

ANTI-PATTERN-02 Avoid
Problem

Quotas are set exactly equal to current usage, to squeeze out every last bit of waste.

Why It’s Harmful

Rolling updates and traffic spikes are blocked, because there is no room for temporary extra pods. The quota becomes a cause of outages.

Correct Approach

Set quotas with meaningful headroom, and use monitoring to find waste over time instead of squeezing it out on day one.

ANTI-PATTERN-03 Avoid
Problem

Compute quotas are applied without any limit range, and existing applications do not declare requests and limits.

Why It’s Harmful

New pods are refused suddenly across the namespace, causing confusing failures and failed releases the very day the quota is introduced.

Correct Approach

Introduce a limit range with sensible defaults first, and make sure applications declare their own sizes before enforcing the quota.

ANTI-PATTERN-04 Avoid
Problem

Team members are allowed to edit or delete the quota in their own namespace whenever they hit it.

Why It’s Harmful

The ceiling becomes a suggestion. Capacity planning fails, and the first team to grab resources wins, defeating the purpose of fair sharing.

Correct Approach

Allow only administrators or a reviewed pipeline to change quotas, and give teams a simple request process for more.

ANTI-PATTERN-05 Avoid
Problem

Teams assume that a quota guarantees capacity, and never check whether the cluster really has room for all namespaces at once.

Why It’s Harmful

When several teams grow at once, pods sit pending even though every namespace is within its quota, and nobody understands why.

Correct Approach

Track real cluster capacity separately from quotas, decide the level of overcommitment deliberately, and add nodes before real capacity runs out.

16Advantages, Disadvantages and Trade-offs

An honest look at what quotas give you, and what they cost.

Advantages

  • Fair sharing of a cluster between many teams
  • Protection against runaway mistakes and surprise bills
  • Limits the damage a compromised namespace can cause
  • Protects the control plane from object floods
  • Encourages teams to declare their real resource needs
  • Simple, built-in and enforced at the front door

Disadvantages / Trade-offs

  • Does not guarantee capacity; it is a ceiling only
  • Sizing takes effort and needs regular review
  • Rejections may look confusing, especially through Deployments
  • Requires requests and limits on every pod once compute quotas exist
  • Static limits cannot react to real-time cluster load
  • Unused quota is wasted allocation that others cannot borrow

The lesson is that quotas bring order and predictability at the cost of some rigidity. A quota that is well sized and well watched is invisible. A quota that is set carelessly becomes a daily source of friction.

“A quota is a promise of fairness, not a promise of capacity. Keep both in mind.”

17Best Practices and Common Mistakes

A checklist of habits that separate smooth clusters from frustrating ones.

Best practices

  • Give every namespace a quota — no exceptions for test or tooling namespaces.
  • Pair quotas with limit ranges — so containers get sensible defaults and are never refused for missing declarations.
  • Size from real data — base numbers on observed usage plus headroom, not on guesses.
  • Leave room for updates — rolling updates need temporary extra capacity.
  • Limit costly objects — cap load balancer services, storage claims and expensive storage classes.
  • Protect the control plane — cap object counts such as secrets, settings and pods.
  • Alert before the ceiling — warn teams at around eighty percent so they can act calmly.
  • Review regularly — adjust quotas as teams grow, shrink or retire.

Common mistakes

!
Mistake: Forgetting That Quotas Are Per Namespace

A quota in one namespace has no effect on another. Teams that span several namespaces need a quota in each, and administrators must watch the total across all of them.

!
Mistake: Blaming the Deployment

When a Deployment stalls, check the quota and the ReplicaSet events first. The Deployment itself is often perfectly healthy, and the pods are simply being refused.

!
Mistake: Ignoring Finished Pods

Completed pods stop counting towards compute quotas, but they may still count towards object limits until deleted. Clean up old finished jobs to keep counts healthy.

!
Mistake: Lowering a Quota and Expecting Instant Relief

Reducing a quota does not remove anything already running. It only prevents new additions. To actually free capacity, scale down or remove workloads.

18Real-World Examples

How quotas show up in everyday engineering.

An Online Shop Preventing a Typing Disaster

A developer at an online shop accidentally asks for a thousand copies of a service in a test namespace. The namespace’s quota allows fifty pods, so the request is refused after the fiftieth. A costly mistake becomes a two-minute correction.

A Bank Offering Tiered Namespaces

A bank gives each team a sandbox, standard or production tier when a namespace is created. Every tier has a quota, a limit range and a cap on load balancers. Requests for a larger tier go through a short approval, and every change is recorded.

A Media Company Sharing Expensive Hardware

A media company shares a small pool of graphics processors between many teams. Each namespace has a quota on the number of processors it may request. Teams book capacity in advance, and no single team can monopolise the hardware.

A Data Team Separating Batch from Services

A data team runs both long-lived services and overnight batch jobs in one namespace. Using scoped quotas, they give the services a steady budget and the batch jobs a larger, time-limited budget, so a heavy overnight run never starves the services.

A Start-up Controlling Its Cloud Bill

A start-up notices unexpected costs from cloud load balancers and fast disks. They add quotas capping load balancer services and fast storage in every namespace. Costs stabilise within a month, and teams simply ask when they need more.

19Frequently Asked Questions

Q1What is the difference between a resource quota and a limit range?

A resource quota limits the total consumption of a whole namespace. A limit range sets rules for individual pods and containers, such as defaults, minimums and maximums. They work best together.

Q2Does a quota guarantee that my namespace will have that much capacity?

No. A quota is only a ceiling. The cluster’s real capacity is separate, and total quotas often exceed it on purpose. A pod can be within quota and still wait because no node has room.

Q3Why was my pod refused for not declaring requests and limits?

When a namespace has a quota on those values, every pod must state them so the quota can count them. A limit range can supply defaults automatically so that pods are not refused.

Q4Why are my Deployment’s pods missing, with no error?

The Deployment was accepted, but its ReplicaSet may be unable to create pods because the quota was exceeded. Check the ReplicaSet events and the quota’s used versus hard values.

Q5What happens to running pods if I lower a quota?

Nothing. Existing pods keep running. The lower limit only blocks new creations until usage falls below the new ceiling.

Q6Can I have more than one quota in a namespace?

Yes. This is common with scopes. A request must satisfy all of them, so the strictest one decides.

Q7Do quotas apply across the whole cluster?

No. Each quota applies to a single namespace. Cluster-wide fairness comes from having a suitable quota in every namespace and watching the overall total.

Q8Can quotas limit storage as well as compute?

Yes. They can cap total requested storage, the number of storage claims, and even the amount per storage class, which is useful for controlling costly fast disks.

Q9Why do rolling updates fail when I am near the quota?

During an update, new pods may start before old ones stop, temporarily needing extra capacity. If the quota has no headroom, the new pods are refused and the update stalls.

Q10What is a good first step to introduce quotas safely?

Measure current usage, add a limit range with sensible defaults, and then apply quotas with generous headroom. Set up alerts at around eighty percent before you tighten anything.

20Summary and Key Takeaways

A resource quota is a namespace-level ceiling on how much of a shared cluster a team may use. It can cap compute, storage and the number of objects, and it is enforced at the front door: when a request would push the total past the limit, the API server refuses it with a clear message. Quotas work best alongside limit ranges, which give each container sensible defaults and sizes, and scopes let you divide a namespace’s budget between different kinds of workloads.

Remember that a quota is a promise of fairness, not of capacity, and that the scheduler still needs real room on a real node. Give every namespace a quota, size from real data with headroom, watch usage before the ceiling is reached, and let only administrators change the limits. Do that, and a shared cluster becomes a calm, fair and predictable place to work.

Key Takeaways

  • A quota is a per-namespace ceiling — it limits the total of compute, storage and object counts across everything in one namespace.
  • Enforcement happens at creation — the API server refuses requests that would exceed the limit, and existing pods are never removed by a quota change.
  • Requests and limits must be declared — with compute quotas in place, every pod must state them, and a limit range can supply defaults.
  • Deployments hide quota failures — the Deployment is accepted, but the ReplicaSet’s pods are refused, so check ReplicaSet events and quota usage.
  • A quota is not a reservation — the scheduler still needs real free room, and the sum of quotas can exceed real capacity.
  • Design with headroom — leave room for rolling updates and spikes, and offer a small menu of tiers.
  • Govern the limits — give every namespace a quota, restrict who can change it, and alert before teams hit the ceiling.