主页

索引

模块索引

搜索页面

3.4.16. ResourceQuota.yaml

相关参考: limitRange

apiVersion: v1
kind: ResourceQuota
metadata:
  name: cpu-and-mem 
spec:
  # This quota only applies to pods that have the BestEffort QoS 
  #     and don’t have an active deadline set.
  scopes:
  - BestEffort
  - NotTerminating
  hard:
    requests.cpu: 400m 
    requests.memory: 200Mi 
    limits.cpu: 600m 
    limits.memory: 500Mi

     # The amount of storage claimable overall
    requests.storage: 500Gi

    # The amount of claimable storage in StorageClass ssd
    ssd.storageclass.storage.k8s.io/requests.storage: 300Gi   
    standard.storageclass.storage.k8s.io/requests.storage: 1Ti

    # Only 10 Pods, 5 ReplicationControllers, 10 Secrets, 10 ConfigMaps, and
    #     4 PersistentVolumeClaims can be created in the namespace.
    pods: 10
    replicationcontrollers: 5
    secrets: 10
    configmaps: 10
    persistentvolumeclaims: 4

    # Five Services overall can be created, of which at most one can be a LoadBalancer Service 
    #     and at most two can be NodePort Services.
    services: 5
    services.loadbalancers: 1

    # Only two PVCs can claim storage with the ssd StorageClass.
    services.nodeports: 2 ssd.storageclass.storage.k8s.io/persistentvolumeclaims: 2

ResourceQuota是namespace级别的, 即在namespace中有一个ResourceQuota, 则此namespace下面的所有pod都受此限制。LimitRange与ResourceQuota的不同:

https://img.zhaoweiguo.com/knowledge/images/k8s/LimitRange_vs_ResourceQuota.png

主页

索引

模块索引

搜索页面