Is there a way to put different limitRange for different StorageClasses per namespace

167 Views Asked by At

I am aware that we can put a ResourceQuota for a StorageClass per namespace which will limit the total amount of storage we can request per StorageClass per namespace. Link

I am also aware that we can create a LimitRange to restrict the individual PersistentVolumeClaim to request storage in a defined range. Link

But I want to have a different LimitRange for each StorageClass that I have defined. Is this possible..?

1

There are 1 best solutions below

0
On

You can create a different limit range object for each project where you want to control resources.

Sample limit range object for a container:

apiVersion: "v1"
kind: "LimitRange"
metadata:
  name: "resource-limits"
spec:
  limits:
    - type: "Container"
      max:
        cpu: "2"
        memory: "1Gi"
      min:
        cpu: "100m"
        memory: "4Mi"
      default:
        cpu: "300m"
        memory: "200Mi"
      defaultRequest:
        cpu: "200m"
        memory: "100Mi"
      maxLimitRequestRatio:
        cpu: "10"

You can create a single LimitRange object for any or all components as necessary. Refer to the link for more information.