Resource quotas of namespaces

By default, pods in Kubernetes are resource-unbounded. The running pods might use up all of the computing or storage resources in a cluster. ResourceQuota is a resource object that allows us to restrict the resource consumption that a namespace could use. By setting up the resource limit, we could reduce the noisy neighbor symptom and ensure that pods can keep running.

Three kinds of resource quotas are currently supported in Kubernetes:

Compute resources
  • requests.cpu
  • requests.memory
  • limits.cpu
  • limits.memory
Storage resources
  • requests.storage
  • <sc>.storageclass.storage.k8s.io/requests
  • <sc>.storageclass.storage.k8s.io/persistentvolumeclaims
Object count
  • count/<resource>.<group>, for example, the following:
    • count/deployments.apps
    • count/persistentvolumeclaims
  • services.loadbalancers
  • services.nodeports

 

Compute resources are quite intuitive, restricting the sum of given resources across all related objects. One thing that should be noted is that once a compute quota has been set, any creation of pods that don't have resource requests or limits will be rejected.

For storage resources, we can associate storage classes in a quota. For example, we can have the two quotas, fast.storageclass.storage.k8s.io/requests: 100G and meh.storageclass.storage.k8s.io/requests: 700G, configured simultaneously to distinguish the resource classes that we installed for reasonably allocating resources.

Existing resources won't be affected by newly created resource quotas. If the resource creation request exceeds the specified ResourceQuota, the resources won't be able to start up.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset