Home › Kubernetes

Error from server (Forbidden): pods is forbidden: exceeded quota (Kubernetes) — how to fix

Error from server (Forbidden): error when creating "pod.yaml": pods "web-7d9f" is forbidden: exceeded quota: compute-quota, requested: limits.cpu=2, used: limits.cpu=3, limited: limits.cpu=4

Quick fix: Run kubectl describe resourcequota -n <ns> to see used vs hard. Then lower the pod's requests/limits, scale down or delete unused workloads, or have an admin raise the quota with kubectl edit resourcequota <name> -n <ns>. For Deployments, the error is in kubectl describe rs -n <ns> events, not in kubectl apply output.

What it means

A ResourceQuota caps the total resources (CPU, memory, number of pods, PVCs, services...) that all objects in one namespace may use. The API server rejects any create or update that would go over it. Read the message from right to left:

requested: limits.cpu=2, used: limits.cpu=3, limited: limits.cpu=4

The new pod wants 2, 3 are already in use, the cap is 4, so 3 + 2 > 4.

This is an admission error, not a scheduling problem: the pod is never created. If pods exist but stay Pending, see insufficient cpu instead.

Find the quota and current usage

kubectl get resourcequota -n myns
kubectl describe resourcequota compute-quota -n myns
Resource         Used  Hard
--------         ----  ----
limits.cpu       3     4
limits.memory    6Gi   8Gi
pods             9     10

Deployments: where the error shows up

kubectl apply of a Deployment succeeds; the ReplicaSet then fails to create pods. Look at its events:

kubectl get deploy,rs -n myns
kubectl describe rs <replicaset-name> -n myns | grep -A5 Events
kubectl get events -n myns --field-selector reason=FailedCreate

A rolling update needs room for the extra surge pods too. If the quota is nearly full, old and new pods together exceed it and the rollout stalls. Set maxSurge: 0 (with maxUnavailable: 1) in the strategy, or free capacity first.

Fix 1: request less

Quota counts requests and limits as declared, not actual usage. Oversized values waste quota:

resources:
  requests:
    cpu: 250m
    memory: 256Mi
  limits:
    cpu: 500m
    memory: 512Mi

Check real usage with kubectl top pods -n myns (needs metrics-server) before lowering.

Fix 2: free up quota

Find what is using the namespace's quota and remove or shrink what you don't need:

kubectl get deploy,statefulset -n myns
kubectl scale deploy old-api --replicas=0 -n myns
kubectl delete deploy old-api -n myns

Pods in a terminal state (Succeeded, Failed) don't count toward compute or pod-count quotas, so deleting finished Job pods won't help with this error. Running pods and object counts (services, PVCs, configmaps if the quota limits them) do.

Fix 3: raise the quota (admin)

kubectl edit resourcequota compute-quota -n myns

or patch it:

kubectl patch resourcequota compute-quota -n myns \
  --type merge -p '{"spec":{"hard":{"limits.cpu":"8","limits.memory":"16Gi"}}}'

On managed platforms (OpenShift projects, shared clusters) quotas are usually owned by the platform team; ask them.

pods "web" is forbidden: failed quota: compute-quota: must specify limits.cpu,limits.memory

When a quota tracks limits.cpu or requests.memory, every new pod must declare that value. Add resources to every container (including init containers and injected sidecars), or create a LimitRange with defaults:

apiVersion: v1
kind: LimitRange
metadata:
  name: defaults
  namespace: myns
spec:
  limits:
  - type: Container
    default:
      cpu: 500m
      memory: 512Mi
    defaultRequest:
      cpu: 100m
      memory: 128Mi

Last updated 2026-12-05.