How to fix must specify requests.cpu, requests.memory in Kubernetes

KubernetesBEGINNERMEDIUMUpdated Dec 5, 2025· 132 views

This admission error occurs when ResourceQuota or LimitRange requires containers to specify resource requests. Fix it by adding explicit requests.cpu and requests.memory to your container spec.

Quick fix

Fixes must specify requests.cpu, requests.memory

# Check ResourceQuota
kubectl describe resourcequota -n <namespace>

# Check LimitRange
kubectl describe limitrange -n <namespace>
  1. Check namespace resource policies
  2. Add resource requests to pod spec
  3. Update Deployment template
  4. Size requests based on actual usage
kubernetes — error
# Check ResourceQuota
kubectl describe resourcequota -n <namespace>
# Check LimitRange
kubectl describe limitrange -n <namespace>
must specify requests.cpu, requests.memory

What this error means

The "must specify requests.cpu, requests.memory" error occurs when a namespace has policies requiring all containers to declare resource requests, but your Pod spec is missing these fields. Resource requests tell Kubernetes the minimum resources a container needs. The scheduler uses requests to find suitable nodes—a pod is only placed on a node if it has enough unrequested capacity. Without requests, Kubernetes can't properly schedule pods or track namespace resource consumption. When ResourceQuota tracks requests.cpu/requests.memory, all pods must specify these values so the quota controller can accurately measure usage against limits.

Typical symptoms

  • Pod creation fails with "must specify requests" error
  • HTTP 403 Forbidden from admission controller
  • Deployment stuck with no available replicas
  • Error occurs even when limits are specified
  • kubectl describe shows admission rejection in events

Common causes

  1. Container spec missing resources.requests section
  2. Namespace ResourceQuota tracks requests.cpu/requests.memory
  3. LimitRange requires explicit requests without defaults
  4. Only limits specified (requests still required)
  5. Multi-container pod where one container lacks requests

How to fix "must specify requests.cpu, requests.memory"

1Check namespace resource policies

View ResourceQuota and LimitRange requirements:

bash
# Check ResourceQuota
kubectl describe resourcequota -n <namespace>

# Check LimitRange
kubectl describe limitrange -n <namespace>

If ResourceQuota shows requests.cpu or requests.memory in spec.hard, pods must specify these.

2Add resource requests to pod spec

Add requests (and limits) to your container:

yaml
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: app
    image: nginx:latest
    resources:
      requests:
        cpu: "250m"          # Required - guaranteed minimum
        memory: "256Mi"      # Required - guaranteed minimum
      limits:
        cpu: "500m"
        memory: "512Mi"

Apply:

bash
kubectl apply -f pod.yaml -n <namespace>
3Update Deployment template

Add resources to all containers in the template:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  template:
    spec:
      containers:
      - name: app
        image: my-image
        resources:
          requests:
            cpu: "100m"
            memory: "128Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"

Apply:

bash
kubectl apply -f deployment.yaml
kubectl get pods -n <namespace>
4Size requests based on actual usage

Check current pod resource consumption:

bash
# View actual usage of running pods
kubectl top pods -n <namespace>

# Get detailed resource metrics
kubectl top pods -n <namespace> --containers

Set requests slightly above typical usage:

yaml
resources:
  requests:
    cpu: "100m"      # If typical usage is 80m
    memory: "128Mi"  # If typical usage is 100Mi
  limits:
    cpu: "500m"      # Allow bursting to 5x
    memory: "256Mi"  # Allow some headroom
5Configure LimitRange defaults

Admin can set defaults so pods without requests still work:

yaml
apiVersion: v1
kind: LimitRange
metadata:
  name: default-resources
  namespace: <namespace>
spec:
  limits:
  - type: Container
    defaultRequest:
      cpu: "100m"
      memory: "64Mi"
    default:
      cpu: "500m"
      memory: "256Mi"

Apply:

bash
kubectl apply -f limitrange.yaml

Now pods without explicit requests receive defaultRequest values.

6Verify pod scheduling

Confirm pods are created and scheduled:

bash
# Watch pod creation
kubectl get pods -n <namespace> -w

# Verify resource allocation
kubectl describe pod <pod-name> -n <namespace> | grep -A3 "Requests"

# Check QoS class
kubectl get pod <pod-name> -o jsonpath='{.status.qosClass}'

If pod is Pending, check node capacity:

bash
kubectl describe nodes | grep -A5 "Allocated resources"

Advanced notes

Requests vs Limits:
- Requests: Minimum guaranteed; used for scheduling decisions
- Limits: Maximum allowed; enforced at runtime
- Scheduler only considers requests, not limits

Scheduling Impact:
- Pod placed on node only if: node available capacity >= pod total requests
- Over-requesting prevents scheduling
- Under-requesting causes contention at runtime

CPU Units:
- 1 = 1 full core
- 500m = 0.5 cores (half a CPU)
- 100m = 0.1 cores

Memory Units:
- Mi = mebibytes (1024²)
- Gi = gibibytes (1024³)
- M = megabytes (1000²)

QoS Classes:
- Guaranteed: requests = limits → least likely eviction
- Burstable: requests < limits → medium priority
- BestEffort: no resources → evicted first

Best Practices:
1. Set requests based on profiled typical usage
2. Set limits 2-4x requests for burstable workloads
3. Use requests = limits for critical workloads (Guaranteed QoS)
4. Monitor actual usage with kubectl top pods and adjust

Frequently asked questions

What does "must specify requests.cpu, requests.memory" mean?
memory" error occurs when a namespace has policies requiring all containers to declare resource requests, but your Pod spec is missing these fields. Resource requests tell Kubernetes the minimum resources a container needs. The scheduler uses requests to find suitable nodes—a pod is only placed on a node if it has enough unrequested capacity.
How do I fix "must specify requests.cpu, requests.memory"?
This admission error occurs when ResourceQuota or LimitRange requires containers to specify resource requests. Fix it by adding explicit requests.cpu and requests.memory to your container spec.
What causes "must specify requests.cpu, requests.memory"?
Container spec missing resources.requests section Namespace ResourceQuota tracks requests.cpu/requests.memory LimitRange requires explicit requests without defaults
Is the "must specify requests.cpu, requests.memory" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading