Your pod creation failed. The error says "exceeded quota". You can't deploy new workloads in the namespace. Resource quotas are blocking your application.

ResourceQuota limits resources in a namespace - pods, CPU, memory, storage, and other objects. When exceeded, new resources can't be created. Let's diagnose and fix this.

Introduction

This article covers troubleshooting steps and solutions for Fix Kubernetes ResourceQuota Exceeded. The error typically occurs in production environments and can cause service disruptions if not addressed promptly.

Symptoms

Common error messages include:

bash
kubectl apply -f deployment.yaml
bash
Error from server (Forbidden): error when creating "deployment.yaml": pods "my-app-5d7b9c8f7-x9k2m" is forbidden: exceeded quota: compute-quota, requested: requests.cpu=500m,requests.memory=512Mi, used: requests.cpu=4,requests.memory=8Gi, limited: requests.cpu=4,requests.memory=8Gi
bash
kubectl get resourcequota -n <namespace>

Common Causes

  • Configuration misconfiguration
  • Missing or incorrect credentials
  • Network connectivity issues
  • Version compatibility problems
  • Resource exhaustion or limits
  • Permission or access denied

Step-by-Step Fix

  1. 1.Check logs for specific error messages
  2. 2.Verify configuration settings
  3. 3.Test network connectivity
  4. 4.Review recent changes
  5. 5.Apply corrective action
  6. 6.Verify the fix

Understanding ResourceQuotas

ResourceQuotas enforce limits on: - Compute resources: CPU, memory requests and limits - Storage resources: PVC count, total storage - Object counts: Pods, Services, ConfigMaps, Secrets, etc.

Each namespace can have multiple ResourceQuotas. When a quota is exceeded, Kubernetes rejects new resource creation.

Step 1: Identify the Error

Check the error from pod creation:

bash
kubectl apply -f deployment.yaml

Error:

bash
Error from server (Forbidden): error when creating "deployment.yaml": pods "my-app-5d7b9c8f7-x9k2m" is forbidden: exceeded quota: compute-quota, requested: requests.cpu=500m,requests.memory=512Mi, used: requests.cpu=4,requests.memory=8Gi, limited: requests.cpu=4,requests.memory=8Gi

The message tells you: - Quota name: compute-quota - What was requested: cpu=500m, memory=512Mi - Current usage: cpu=4, memory=8Gi - Limit: cpu=4, memory=8Gi

Step 2: List ResourceQuotas in Namespace

Check quotas in the affected namespace:

bash
kubectl get resourcequota -n <namespace>
bash
NAME            AGE   REQUEST                                   LIMIT
compute-quota   30d   cpu: 4/4, memory: 8Gi/8Gi                 30d
storage-quota   30d   requests.storage: 50Gi/100Gi              30d
object-quota    30d   pods: 10/10, services: 5/5               30d

The format shows used/limit. Values at the limit mean quota is exhausted.

Step 3: Describe ResourceQuota for Details

Get detailed quota information:

bash
kubectl describe resourcequota compute-quota -n <namespace>
bash
Name:            compute-quota
Namespace:       production
Resource         Used   Hard
--------         ----   ----
cpu              4      4
limits.cpu       8      8
memory           8Gi    8Gi
limits.memory    16Gi   16Gi
pods             10     10
requests.storage 50Gi   100Gi

The "Hard" column shows limits. "Used" shows current consumption.

Step 4: Check Current Resource Usage

List pods and their resource requests:

bash
kubectl get pods -n <namespace> -o custom-columns=NAME:.metadata.name,CPU:.spec.containers[*].resources.requests.cpu,MEMORY:.spec.containers[*].resources.requests.memory
bash
NAME                       CPU     MEMORY
app-a-5d7b9c8f7-x9k2m      500m    512Mi
app-b-6c8d9e0f-y2l3n       1       1Gi
app-c-7d9e0f1g-z3m4o       500m    512Mi
worker-8e0f1g2h-a4n5p      1       2Gi
...

Calculate total usage:

bash
kubectl get pods -n <namespace> -o json | jq '[.items[].spec.containers[].resources.requests | {cpu: .cpu, memory: .memory}]'

Step 5: Identify Which Resource is Exceeded

Based on the error message and quota details, identify the limiting resource:

CPU quota exceeded: `` requested: requests.cpu=500m, used: requests.cpu=4, limited: requests.cpu=4

Memory quota exceeded: `` requested: requests.memory=512Mi, used: requests.memory=8Gi, limited: requests.memory=8Gi

Pod count exceeded: `` requested: pods=1, used: pods=10, limited: pods=10

Storage quota exceeded: `` requested: requests.storage=10Gi, used: requests.storage=100Gi, limited: requests.storage=100Gi

Step 6: Reduce Resource Requests

If you can't increase the quota, reduce your resource requests:

```yaml # Original - too large resources: requests: cpu: 500m memory: 512Mi

# Reduced to fit quota resources: requests: cpu: 100m memory: 256Mi ```

Right-size your pods based on actual usage:

bash
# Check actual resource usage
kubectl top pods -n <namespace>
bash
NAME                       CPU(cores)   MEMORY(bytes)
app-a-5d7b9c8f7-x9k2m      50m          128Mi
app-b-6c8d9e0f-y2l3n       200m         400Mi

If pods use less than requested, reduce the requests.

Step 7: Delete Unused Resources

Free up quota by removing unused resources:

```bash # List all pods kubectl get pods -n <namespace>

# Delete failed or completed pods kubectl delete pod failed-pod-name -n <namespace>

# For completed jobs kubectl get jobs -n <namespace> kubectl delete job completed-job -n <namespace>

# Clean up evicted pods kubectl get pods -n <namespace | grep Evicted | awk '{print $1}' | xargs kubectl delete pod -n <namespace> ```

Step 8: Request Quota Increase

If you legitimately need more resources, request a quota increase:

bash
# Edit the ResourceQuota
kubectl edit resourcequota compute-quota -n <namespace>

Update the limits:

yaml
spec:
  hard:
    cpu: "6"          # Increase from 4
    memory: 12Gi      # Increase from 8Gi
    pods: "15"        # Increase from 10

Or create a patch:

bash
kubectl patch resourcequota compute-quota -n <namespace> --type=merge -p '{"spec":{"hard":{"cpu":"6","memory":"12Gi"}}}'

Note: You need cluster-admin privileges to modify quotas.

Step 9: Create a New Namespace with Quota

If you can't increase quota, create a new namespace:

yaml
apiVersion: v1
kind: Namespace
metadata:
  name: new-namespace
---
apiVersion: v1
kind: ResourceQuota
metadata:
  name: compute-quota
  namespace: new-namespace
spec:
  hard:
    cpu: "4"
    memory: 8Gi
    pods: "10"

Deploy your workload in the new namespace.

Step 10: Check for LimitRange Conflicts

LimitRanges can also affect quota. Check for LimitRange:

bash
kubectl get limitrange -n <namespace>
kubectl describe limitrange -n <namespace>

LimitRange sets default and min/max for resources. If your pod requests are below the min, they're adjusted to min, consuming more quota.

yaml
# LimitRange with defaults
spec:
  limits:
  - type: Container
    default:
      cpu: 200m       # Default request
    defaultRequest:
      cpu: 100m
    min:
      cpu: 50m
    max:
      cpu: 2

Common Quota Issues

Issue: Pod request too small, adjusted by LimitRange

bash
# Pod requests 10m CPU
# LimitRange min is 50m
# Pod adjusted to 50m, consuming more quota than expected

Solution: Either set requests equal to or above LimitRange min, or modify LimitRange.

Issue: Quota doesn't account for limits

yaml
# Quota only tracks requests, not limits
spec:
  hard:
    requests.cpu: "4"
    requests.memory: 8Gi
# No limits quota

Pods can set high limits without quota enforcement. Add limits quota:

yaml
spec:
  hard:
    limits.cpu: "8"
    limits.memory: 16Gi

Issue: Storage quota blocks PVC creation

bash
Error: exceeded quota: storage-quota, requested: requests.storage=10Gi, used: 100Gi, limited: 100Gi

Solution: Delete unused PVCs:

bash
kubectl get pvc -n <namespace>
kubectl delete pvc unused-pvc -n <namespace>

Issue: Quota doesn't cover all resource types

Some resources aren't in quota and can accumulate:

bash
# Check object counts
kubectl get all -n <namespace>
kubectl get configmaps -n <namespace>
kubectl get secrets -n <namespace>

Add object quotas:

yaml
spec:
  hard:
    configmaps: "10"
    secrets: "10"
    services: "5"
    replicationcontrollers: "5"

Verification

After resolving quota issues:

```bash # Verify quota has room kubectl describe resourcequota compute-quota -n <namespace>

# Create your pod kubectl apply -f deployment.yaml

# Verify pod is running kubectl get pods -n <namespace> ```

Prevention

  1. 1.Monitor quota usage regularly:
bash
kubectl get resourcequota -n <namespace> -o yaml | grep -E "used|hard"
  1. 1.Set appropriate limits based on actual usage, not guesswork.
  2. 2.Use quota alerts in monitoring:
yaml
# Prometheus alert for quota approaching limit
- alert: NamespaceQuotaApproachingLimit
  expr: |
    kubernetes_resourcequota_used / kubernetes_resourcequota_hard > 0.9
  1. 1.Plan capacity before hitting quota limits.
  2. 2.Clean up unused resources regularly:
bash
# CronJob to clean up completed jobs
kubectl delete jobs --field-selector status.successful=1 -n <namespace>

Quick Diagnostic Script

```bash #!/bin/bash NAMESPACE=${1:-default}

echo "=== ResourceQuotas ===" kubectl get resourcequota -n $NAMESPACE

echo -e "\n=== Quota Details ===" kubectl describe resourcequota -n $NAMESPACE

echo -e "\n=== Pod Resource Requests ===" kubectl get pods -n $NAMESPACE -o custom-columns=NAME:.metadata.name,CPU_REQ:.spec.containers[*].resources.requests.cpu,MEM_REQ:.spec.containers[*].resources.requests.memory,CPU_LIM:.spec.containers[*].resources.limits.cpu,MEM_LIM:.spec.containers[*].resources.limits.memory

echo -e "\n=== Actual Resource Usage ===" kubectl top pods -n $NAMESPACE

echo -e "\n=== LimitRanges ===" kubectl get limitrange -n $NAMESPACE

echo -e "\n=== Pod Count ===" kubectl get pods -n $NAMESPACE --no-headers | wc -l ```

Key Takeaways

  1. 1.ResourceQuota limits namespace resources - CPU, memory, pods, storage
  2. 2.Check quota with kubectl describe resourcequota to see used vs hard limits
  3. 3.Reduce resource requests or delete unused pods to free quota
  4. 4.Increase quota requires cluster-admin privileges
  5. 5.LimitRange can adjust requests, affecting quota consumption
  6. 6.Monitor quota usage proactively to prevent exceeding limits

ResourceQuota is designed to prevent resource hoarding. When exceeded, either free resources by deleting unused workloads, reduce requests, or request a quota increase from your administrator.

  • [Fix Envoy Rate Limit Configuration with envoyproxy/ratelimit](envoyproxy-ratelimit-configuration-guide)
  • [Fix Fix Argocd App Not Syncing Issue in Kubernetes](fix-argocd-app-not-syncing)
  • [Fix Fix Argocd Sync Conflict Issue in Kubernetes](fix-argocd-sync-conflict)
  • [Fix ArgoCD Sync Timeout](fix-argocd-sync-timeout)
  • [How to Fix Cilium Identity Exhaustion and Endpoint Allocation Failed](fix-cilium-identity-exhaustion)

<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Fix Kubernetes ResourceQuota Exceeded", "description": "Learn how to fix ResourceQuota exceeded errors in Kubernetes with solutions for CPU, memory, pod count, and storage quota limits.", "url": "https://www.fixwikihub.com/fix-kubernetes-resource-quota-exceeded", "publisher": { "@type": "Organization", "name": "FixWikiHub", "url": "https://www.fixwikihub.com" }, "author": { "@type": "Person", "name": "FixWikiHub Editorial Team" }, "datePublished": "2025-11-24T01:00:46.140Z", "dateModified": "2025-11-24T01:00:46.140Z" } </script>