resourceQuota creation in kubernetes

I created the following yaml files for resourcequota and deployment on the multinode environment

apiVersion: v1
kind: ResourceQuota
metadata:
    name: rq1
spec:
  hard:
    requests.cpu: 4
    limits.cpu: 8
apiVersion: apps/v1
kind: Deployment
metadata:
  name: rqd
spec:
  replicas: 4
  selector:
    matchLabels:
      app: web
  template:
     metadata:
       labels:
         app: web
     spec:
         containers:
           - image: nginx
             name: container1
             resources:
               requests:
                 cpu: 2
               limits:
                   cpu: 4

And as expected , i saw 2 pods only deployed. But there was no errors in the deployment log to explain why the 2 pods are not getting created. If we get something similar in exam, how do we debug ?

What does the kubectl describe show for the Deployment?

Since you have reached the cluster’s allotted quota, you can no longer provision a pod in that cluster. You can try that by running another pod and see why it fails.

Ok. so the answer lies in describing the replicaset

> kubectl describe rs rqd-c556d878b
> Name:           rqd-c556d878b
> Namespace:      default
> Selector:       app=web,pod-template-hash=c556d878b
> Labels:         app=web
>                 pod-template-hash=c556d878b
> Annotations:    deployment.kubernetes.io/desired-replicas: 4
>                 deployment.kubernetes.io/max-replicas: 5
>                 deployment.kubernetes.io/revision: 1
> Controlled By:  Deployment/rqd
> Replicas:       1 current / 4 desired
> Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
> Pod Template:
>   Labels:  app=web
>            pod-template-hash=c556d878b
>   Containers:
>    container1:
>     Image:      nginx
>     Port:       <none>
>     Host Port:  <none>
>     Limits:
>       cpu:  10
>     Requests:
>       cpu:         2
>     Environment:   <none>
>     Mounts:        <none>
>   Volumes:         <none>
>   Node-Selectors:  <none>
>   Tolerations:     <none>
> Conditions:
>   Type             Status  Reason
>   ----             ------  ------
>   ReplicaFailure   True    FailedCreate
> Events:
>   Type     Reason            Age                 From                   Message
>   ----     ------            ----                ----                   -------
>   Normal   SuccessfulCreate  7m25s               replicaset-controller  Created pod: rqd-c556d878b-zqh22
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-t7cpz" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-hb6h2" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-9jbvz" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-b7z5p" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-7vzhz" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-pf4m2" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-6cbvb" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-w9n7b" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      7m25s               replicaset-controller  Error creating: pods "rqd-c556d878b-678jl" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10
>   Warning  FailedCreate      5m (x9 over 7m25s)  replicaset-controller  (combined from similar events): Error creating: pods "rqd-c556d878b-h8b66" is forbidden: exceeded quota: rq1, requested: limits.cpu=10, used: limits.cpu=10, limited: limits.cpu=10