# Failed quota when limits.cpu is set

**URL:** <https://discuss.kubernetes.io/t/failed-quota-when-limits-cpu-is-set/18494>\
**Category:** General Discussions\
**Created:** [December 22, 2021, 6:17pm UTC](https://discuss.kubernetes.io/t/failed-quota-when-limits-cpu-is-set/18494 "2021-12-22T18:17:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pablo\_Cavalieri](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/pablo_cavalieri/32/9188_2.png) [@Pablo\_Cavalieri](https://discuss.kubernetes.io/u/Pablo_Cavalieri)\
**Post date:** [December 22, 2021, 6:17pm UTC](https://discuss.kubernetes.io/t/failed-quota-when-limits-cpu-is-set/18494/1 "2021-12-22T18:17:01Z")

</div>

I’m trying to apply a Kubernetes `Deployment` manifest on a `namespace` that contains a `quota` called _compute-resources_, with only the _limits.cpu_ set.

```auto
kubectl -n <namesapce> describe quota compute-resources
Name: compute-resources
Namespace: stage-pctest
Resource Used Hard
-------- ---- ----
limits.cpu 17512m 400

```

When I apply a `Deployment` manifest, with the `resources.limits.cpu` set, I get a _Error creating: pods “” is forbidden: failed quota: compute-resources: must specify limits.cpu_.  
`Deployment` manifest:

```auto
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: <app name>
  name: <app name>
spec:
  progressDeadlineSeconds: 60
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: <app name>
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "true"
      creationTimestamp: null
      labels:
        app: <app name>
    spec:
      containers:
      - env:
          <end properties>
        image: <image reference>
        resources:
          limits:
            cpu: 1000m
        imagePullPolicy: Always
        name: user-container
        ports:
        - containerPort: 8191
          protocol: TCP
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/jwt
          name: jwt
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: jwt
        secret:
          defaultMode: 420
          secretName: qc-app-jwt-token

```

When I describe the deployment’s _replicaset_ I git these:

```auto
Name: <app name>-65dbcf47c9
Namespace: <namespace>
Selector: app=<app name>,pod-template-hash=65dbcf47c9
Labels: app=<app name>
                pod-template-hash=65dbcf47c9
Annotations: deployment.kubernetes.io/desired-replicas: 1
                deployment.kubernetes.io/max-replicas: 2
                deployment.kubernetes.io/revision: 1
Controlled By: Deployment/<app name>
Replicas: 0 current / 1 desired
Pods Status: 0 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels: app=<app name>
                pod-template-hash=65dbcf47c9
  Annotations: sidecar.istio.io/inject: true
  Containers:
   user-container:
    Image: <image reference>
    Port: 8191/TCP
    Host Port: 0/TCP
    Limits:
      cpu: 1
    Environment Variables from:
      <configma name> ConfigMap Optional: false
    Environment:
	  <env values>
    Mounts:
      /etc/jwt from jwt (rw)
  Volumes:
   jwt:
    Type: Secret (a volume populated by a Secret)
    SecretName: <secret name>
    Optional: false
Conditions:
  Type Status Reason
  ---- ------ ------
  ReplicaFailure True FailedCreate
Events:
  Type Reason Age From Message
  ---- ------ ---- ---- -------
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-9clmx" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-bpkgv" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-l62n2" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-gmgjj" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-55jc7" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-7swww" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-tgw8z" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 19s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-5285t" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 18s replicaset-controller Error creating: pods "<app name>-65dbcf47c9-l7wgl" is forbidden: failed quota: compute-resources: must specify limits.cpu
  Warning FailedCreate 9s (x3 over 17s) replicaset-controller (combined from similar events): Error creating: pods "<app name>-65dbcf47c9-q5rqf" is forbidden: failed quota: compute-resources: must specify limits.cpu

```

When using the `quotas` _requests.cpu_ the `Deployment` works as described in the documentation ([Resource Quotas | Kubernetes](https://kubernetes.io/docs/concepts/policy/resource-quotas/)), if no _spec.containers[].resources.requests.cpu_ are set, the `ReplicaSet` fails with a descriptive message (missing _requests.cpu_)
