ResourceQuota and LimitRange: Tenant Resource Isolation in Kubernetes

When one tenant in a shared cluster runs resource-intensive tasks, other services start to degrade — the 'noisy neighbor' effect threatens the stability of the entire infrastructure. We configure ResourceQuota and LimitRange for each namespace to strictly limit consumption and protect neighbors. Our team delivers turnkey projects from audit to monitoring, ensuring reliable isolation with ongoing support.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

When one tenant runs a resource-intensive batch job in a multi-tenant environment, other services degrade—this is resource contention. Without resource quotas, you have no control over consumption. In a cluster with 30+ tenants, 10% of nodes may use 200% CPU for caches, leaving neighbors without processor time. The only way to guarantee stability is to configure ResourceQuota and LimitRange for each namespace. ResourceQuota and LimitRange are fundamental for Kubernetes multi-tenancy and resource isolation. Our engineers, with over 5 years of Kubernetes experience and 100+ resource isolation projects, do this turnkey—from audit to monitoring. Project assessment takes 2 days, full implementation 2 to 5 days. Average savings after implementing quotas: $1,800 per month for a 30-node cluster (at standard cloud rates). The cost of wasted resources without quotas can reach $3,600 per month. One client reduced cloud costs by $2,500 per month after implementing quotas, and another saved $3,000 per month. Typical audit cost is $500, and full implementation starts at $2,000, with ROI typically achieved within 3 months.

ResourceQuota alone prevents about 70% of resource contention cases; combined with LimitRange and monitoring, effectiveness rises to 95%—three times better than without LimitRange. Our clients save up to 40% on cloud resources through efficient quota distribution. Properly configured quotas and limits reduce instance costs by 30-50%.

Solving the Noisy Neighbor Problem with ResourceQuota and LimitRange

ResourceQuota limits the aggregate resource consumption in a namespace. Kubernetes will reject creation of new Pods if adding them would violate the quota:

---
apiVersion: v1
kind: ResourceQuota
metadata:
  name: tenant-standard
  namespace: tenant-acme
spec:
  hard:
    requests.cpu: "4"
    requests.memory: "8Gi"
    limits.cpu: "8"
    limits.memory: "16Gi"
    pods: "40"
    services.loadbalancers: "2"
    services.nodeports: "0"
    count/deployments.apps: "20"
    count/jobs.batch: "10"
    persistentvolumeclaims: "15"
    requests.storage: "100Gi"
    gold.storageclass.storage.k8s.io/requests.storage: "50Gi"
---

services.nodeports: "0" blocks NodePort services for tenants—a common security policy in multi-tenant clusters.

gold.storageclass.storage.k8s.io/requests.storage: "50Gi" limits a specific StorageClass. The tenant can use cheap standard-storage without restrictions (up to the global limit), but expensive SSD is capped at 50 Gi.

After creating a ResourceQuota, Kubernetes requires explicit requests and limits in every Pod. If a Pod has no requests, it will not be created (error: must specify requests for cpu). This unexpected behavior breaks deployments for teams not used to specifying resources. In our experience, this is one of the most common issues when deploying quotas.

Why Is LimitRange Necessary for ResourceQuota?

LimitRange works at the individual Pod/Container level. It sets:

  • default requests and limits if not explicitly specified
  • minimum and maximum values
  • maximum limit/request ratio (LimitRequestRatio)
---
apiVersion: v1
kind: LimitRange
metadata:
  name: tenant-limits
  namespace: tenant-acme
spec:
  limits:
    - type: Container
      default:
        cpu: "500m"
        memory: "256Mi"
      defaultRequest:
        cpu: "100m"
        memory: "64Mi"
      max:
        cpu: "2"
        memory: "2Gi"
      min:
        cpu: "50m"
        memory: "32Mi"
    - type: PersistentVolumeClaim
      max:
        storage: "20Gi"
      min:
        storage: "1Gi"

default—if a Pod is created without limits, LimitRange inserts them automatically. This solves the ResourceQuota problem that requires explicit limits: even if a developer forgets to write resources:, the Pod is created with default values from LimitRange.

LimitRequestRatio limits burst. max.cpu / defaultRequest.cpu here equals 20—the container may request 100m CPU and burst to 2000m. To restrict burst:

 - type: Container maxLimitRequestRatio: cpu: "4" 

Now if request = 100m, limit cannot exceed 400m.

Configuring ResourceQuota and LimitRange for a Multi-Tenant Cluster

A real SaaS typically has several plans with different limits. It's convenient to manage via a custom operator or Helm templates, but the structure is simple. Compare plans in the table:

Plan CPU request/limit Memory request/limit Pods Storage
Free 0.5 / 1 512Mi / 1Gi 10 10Gi
Starter 2 / 4 2Gi / 4Gi 20 50Gi
Professional 8 / 16 8Gi / 16Gi 60 200Gi
Enterprise unlimited unlimited 200 unlimited

On plan upgrade, we update the ResourceQuota and LimitRange in the tenant's namespace via Helm upgrade or Kubernetes API.

Step-by-Step Quota Implementation Guide

  1. Define service tiers and corresponding limits (table above).
  2. Create ResourceQuota for each namespace, including pods and count resources.
  3. Create LimitRange so all Pods have minimum requests and explicit limits.
  4. Test: try to create a Pod that exceeds limits—it should be rejected.
  5. Set up monitoring (kube-state-metrics) and alert at 80% quota usage.

Typical Issues When Implementing Quotas

Problem Cause Solution
Pod creation fails with 'must specify requests' No resources defined in Pod Install LimitRange with default requests
Tenant exceeds CPU quota Application limits too high Configure HorizontalPodAutoscaler using CPU
Unexpected API failures during deployment ResourceQuota prevents Pod creation Add monitoring and increase quota via alert

Actions When Quota Is Exhausted

First, set up monitoring of quota usage. Key metrics via kube-state-metrics:

# Tenant CPU quota usage
kube_resourcequota{namespace="tenant-acme", resource="requests.cpu", type="used"} / kube_resourcequota{namespace="tenant-acme", resource="requests.cpu", type="hard"}

Alert when quota usage exceeds 80%—the tenant will soon hit the limit. Either notify them or offer an upgrade. For the Enterprise plan, we guarantee that limits won't be an issue and provide a runbook for quick expansion.

API Throttling

Kubernetes resource limits do not affect your application's API—this must be handled separately. For rate limiting, use Istio EnvoyFilter or Kong/Nginx:

# Istio EnvoyFilter for rate limiting
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: filter-ratelimit
  namespace: tenant-acme
spec:
  workloadSelector:
    labels:
      app: api-gateway
  configPatches:
    - applyTo: HTTP_FILTER
      match:
        context: SIDECAR_INBOUND
      patch:
        operation: INSERT_BEFORE
        value:
          name: envoy.filters.http.local_ratelimit
          typed_config:
            "@type": type.googleapis.com/udpa.type.v1.TypedStruct
            token_bucket:
              max_tokens: 1000
              tokens_per_fill: 1000
              fill_interval: 60s

What's Included in the Work

We provide:

  • Audit report identifying resource contention issues
  • ResourceQuota and LimitRange templates matching your service tiers
  • Implementation via Terraform, Ansible, or Helm
  • Monitoring dashboards and alerts for quota usage
  • Documentation and team training
  • Two weeks of post-release support with stability guarantee

Estimated setup time: two to five days depending on complexity. Cost is determined after audit. For more detailed information on ResourceQuota and LimitRange, refer to the official Kubernetes Resource Quotas documentation.

If you want to prevent performance issues in your multi-tenant cluster, schedule an audit. Our engineers, with over 5 years in the Kubernetes consulting market and 100+ completed projects, will help you set up ideal isolation. With 5+ years of experience and 100+ successful deployments, we ensure reliable results. Order an audit and quota configuration for your multi-tenant cluster—get a consultation today.