# Request for Assistance with ResourceQuota Configuration

**URL:** <https://discuss.kubernetes.io/t/request-for-assistance-with-resourcequota-configuration/27140>\
**Category:** General Discussions\
**Created:** [February 18, 2024, 4:19pm UTC](https://discuss.kubernetes.io/t/request-for-assistance-with-resourcequota-configuration/27140 "2024-02-18T16:19:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto\_Devops](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/roberto_devops/32/14252_2.png) [@Roberto\_Devops](https://discuss.kubernetes.io/u/Roberto_Devops)\
**Post date:** [February 18, 2024, 4:19pm UTC](https://discuss.kubernetes.io/t/request-for-assistance-with-resourcequota-configuration/27140/1 "2024-02-18T16:19:20Z")

</div>

Hello,

I hope this message finds you well. I am currently working on setting up ResourceQuotas in our Kubernetes cluster, and I’m seeking assistance in creating the necessary configurations.

Below are the ten ResourceQuota manifests that I need to implement:

CPU ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: cpu-quota
spec:
  hard:
    limits.cpu: "4"

```

Example Manifest to Test the Limit:

```auto
apiVersion: v1
kind: Pod
metadata:
  name: cpu-pod
spec:
  containers:
  - name: cpu-container
    image: nginx
    resources:
      limits:
        cpu: "2"

```

This Pod requests 2 CPU cores. It should be allowed since it’s below the 4 CPU core limit set by the ResourceQuota.

Memory ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: memory-quota
spec:
  hard:
    limits.memory: "4Gi"

```

Example Manifest to Test the Limit:

```auto
apiVersion: v1
kind: Pod
metadata:
  name: memory-pod
spec:
  containers:
  - name: memory-container
    image: nginx
    resources:
      limits:
        memory: "2Gi"

```

This Pod requests 2GiB of memory. It should be allowed since it’s below the 4GiB memory limit set by the ResourceQuota.

Pods ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: pods-quota
spec:
  hard:
    pods: "10"

```

Example Manifests to Test the Limit:

```auto
apiVersion: v1
kind: Pod
metadata:
  name: pods-pod
spec:
  containers:
  - name: pods-container
    image: nginx
---
apiVersion: v1
kind: Pod
metadata:
  name: pods-pod2
spec:
  containers:
  - name: pods-container2
    image: nginx

```

These Pods attempt to be created in the same namespace. Since the ResourceQuota allows only 10 Pods, only one of these Pods will be allowed to be created.

Services ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: services-quota
spec:
  hard:
    services: "5"

```

Example Service Manifest to Test the Limit:

```auto
apiVersion: v1
kind: Service
metadata:
  name: service-test
spec:
  selector:
    app: nginx
  ports:
  - port: 80
    targetPort: 80

```

This Service is attempting to be created. Since the ResourceQuota allows only 5 Services, it should be allowed.

ConfigMaps ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: configmaps-quota
spec:
  hard:
    configmaps: "5"

```

Example ConfigMap Manifest to Test the Limit:

```auto
apiVersion: v1
kind: ConfigMap
metadata:
  name: configmap-test
data:
  key1: value1

```

This ConfigMap is attempting to be created. Since the ResourceQuota allows only 5 ConfigMaps, it should be allowed.

Secrets ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: secrets-quota
spec:
  hard:
    secrets: "5"

```

Example Secret Manifest to Test the Limit:

```auto
apiVersion: v1
kind: Secret
metadata:
  name: secret-test
data:
  key: dmFsdWUx

```

This Secret is attempting to be created. Since the ResourceQuota allows only 5 Secrets, it should be allowed.

PersistentVolumeClaims (PVCs) ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: pvcs-quota
spec:
  hard:
    persistentvolumeclaims: "5"

```

Example PVC Manifest to Test the Limit:

```auto
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-test
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

```

This PVC is attempting to be created. Since the ResourceQuota allows only 5 PVCs, it should be allowed.

Ingresses ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: ingresses-quota
spec:
  hard:
    ingresses.extensions: "5"

```

Example Ingress Manifest to Test the Limit:

```auto
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-test
spec:
  rules:
  - host: test.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: service-test
            port:
              number: 80

```

This Ingress is attempting to be created. Since the ResourceQuota allows only 5 Ingresses, it should be allowed.

ReplicaSets ResourceQuota:

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: replicasets-quota
spec:
  hard:
    replicasets.apps: "5"

```

Example ReplicaSet Manifest to Test the Limit:

```auto
apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: rs-test
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx

```

This ReplicaSet is attempting to be created with 3 replicas. Since the ResourceQuota allows only 5 ReplicaSets, it should be allowed.

ResourceQuotas ResourceQuota (limiting the number of ResourceQuotas):

```auto
apiVersion: v1
kind: ResourceQuota
metadata:
  name: resourcequotas-quota
spec:
  hard:
    resourcequotas: "1"

```

No testing example provided as this ResourceQuota limits the number of ResourceQuotas that can be created within the namespace.

I’m reaching out to inquire if there is an easier or more efficient way to create these configurations. If there are any tools, scripts, or best practices that you recommend for generating these ResourceQuota manifests, I would greatly appreciate your guidance.

Thank you very much for your time and assistance.

---

<div class="post-metadata">

**Author:** ![fox-md](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/fox-md/32/10613_2.png) [@fox-md](https://discuss.kubernetes.io/u/fox-md)\
**Post date:** [February 18, 2024, 8:40pm UTC](https://discuss.kubernetes.io/t/request-for-assistance-with-resourcequota-configuration/27140/2 "2024-02-18T20:40:49Z")

</div>

Hi,  
I assume you are looking for something like [Add Quota | Kyverno](https://kyverno.io/policies/best-practices/add-ns-quota/add-ns-quota/)  
HTH
