title: Kubernetes failed quota when limits.cpu is set
body: <p>I'm trying to apply a Kubernetes <code>Deployment</code> manifest on a <code>namespace</code> that contains a <code>quota</code> called <em>compute-resources</em>, with only the <em>limits.cpu</em> set.</p>
  <pre><code>kubectl -n &lt;namesapce&gt; describe quota compute-resources
  Name:       compute-resources
  Namespace:  stage-pctest
  Resource    Used    Hard
  --------    ----    ----
  limits.cpu  17512m  400
  </code></pre>
  <p>When I apply a <code>Deployment</code> manifest, with the <code>resources.limits.cpu</code> set, I get a <em>Error creating: pods &quot;&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu</em>.
  <code>Deployment</code> manifest:</p>
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    labels:
      app: &lt;app name&gt;
    name: &lt;app name&gt;
  spec:
    progressDeadlineSeconds: 60
    replicas: 1
    revisionHistoryLimit: 10
    selector:
      matchLabels:
        app: &lt;app name&gt;
    strategy:
      rollingUpdate:
        maxSurge: 25%
        maxUnavailable: 25%
      type: RollingUpdate
    template:
      metadata:
        annotations:
          sidecar.istio.io/inject: &quot;true&quot;
        creationTimestamp: null
        labels:
          app: &lt;app name&gt;
      spec:
        containers:
        - env:
            &lt;end properties&gt;
          image: &lt;image reference&gt;
          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
  </code></pre>
  <p>When I describe the deployment's <em>replicaset</em> I git these:</p>
  <pre><code>Name:           &lt;app name&gt;-65dbcf47c9
  Namespace:      &lt;namespace&gt;
  Selector:       app=&lt;app name&gt;,pod-template-hash=65dbcf47c9
  Labels:         app=&lt;app name&gt;
                  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/&lt;app name&gt;
  Replicas:       0 current / 1 desired
  Pods Status:    0 Running / 0 Waiting / 0 Succeeded / 0 Failed
  Pod Template:
    Labels:       app=&lt;app name&gt;
                  pod-template-hash=65dbcf47c9
    Annotations:  sidecar.istio.io/inject: true
    Containers:
     user-container:
      Image:      &lt;image reference&gt;
      Port:       8191/TCP
      Host Port:  0/TCP
      Limits:
        cpu:  1
      Environment Variables from:
        &lt;configma name&gt;  ConfigMap  Optional: false
      Environment:
        &lt;env values&gt;
      Mounts:
        /etc/jwt from jwt (rw)
    Volumes:
     jwt:
      Type:        Secret (a volume populated by a Secret)
      SecretName:  &lt;secret name&gt;
      Optional:    false
  Conditions:
    Type             Status  Reason
    ----             ------  ------
    ReplicaFailure   True    FailedCreate
  Events:
    Type     Reason        Age               From                   Message
    ----     ------        ----              ----                   -------
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-9clmx&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-bpkgv&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-l62n2&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-gmgjj&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-55jc7&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-7swww&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-tgw8z&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  19s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-5285t&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
    Warning  FailedCreate  18s               replicaset-controller  Error creating: pods &quot;&lt;app name&gt;-65dbcf47c9-l7wgl&quot; 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 &quot;&lt;app name&gt;-65dbcf47c9-q5rqf&quot; is forbidden: failed quota: compute-resources: must specify limits.cpu
  </code></pre>
  <p>When using the <code>quotas</code> <em>requests.cpu</em> the <code>Deployment</code> works as described in the documentation (<a href="https://kubernetes.io/docs/concepts/policy/resource-quotas/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/policy/resource-quotas/</a>), if no <em>spec.containers[].resources.requests.cpu</em> are set, the <code>ReplicaSet</code> fails with a descriptive message (missing <em>requests.cpu</em>)</p>