Namespace-level resource quotas limit the total amount of resources that teams or users can use when sharing a cluster. This includes limiting the number of objects of a specific type that can be created in a namespace and the total amount of compute resources (CPU and memory) that objects can consume. This topic describes how to set resource quotas in the console.
Currently, only single-cluster namespaces support resource quotas.
Background information
By default, running pods can use unlimited CPU and memory on a node. This means any pod can consume an unrestricted amount of a cluster's compute resources, which can lead to pods in one namespace exhausting the cluster's resources.
An important function of a namespace is to serve as a virtual cluster to support different projects and multiple users. Therefore, configuring resource quotas for a namespace is a best practice. You can configure quotas for resources such as CPU, memory, and the number of pods for a namespace.
For more information, see Resource Quotas.
How it works
A resource quota is a policy that limits resource usage within a namespace.
Resource quotas are applied to namespaces. You can create one or more resource quota objects for each namespace.
After you set a quota for compute resources, such as CPU or memory, you must specify requests or limits for those resources when you create a pod.
If a request to create a resource would cause the namespace to exceed its quota, the request is rejected.
Prerequisites
Procedure
Log on to the LHC console. In the navigation pane on the left, click Cluster Management > Clusters to open the cluster list page.
Click the name of the destination cluster to open the Cluster Details page, and then click the Namespaces tab.
In the Actions column of the destination namespace, click Resource Quota.
In the Resource Quota dialog box, configure the resource quotas as needed. If you do not set a quota for a resource, its usage remains unlimited.
Configure compute resource limits.
NoteAfter you set a CPU or memory quota for a namespace, you must specify CPU or memory resource limits when you create a pod. For more information, see Resource Quotas.
Configuration item
Description
Unit
CPU Limit
The maximum amount of CPU resources that pods in the namespace can request.
Cores
Memory Limit
The maximum amount of memory resources that pods in the namespace can request.
Mi, Gi, Ti, M, G, T
Configure storage resource limits.
Configuration item
Description
Unit
Storage
The maximum amount of storage allowed in the namespace.
Mi, Gi, Ti, M, G, T
Number of PVCs
The maximum number of persistent volume claims (PVCs) allowed in the namespace.
Unit
Configure other resource limits.
Configuration item
Description
Unit
Number of configuration files
The maximum number of configuration files allowed in the namespace.
Item
Number of pods
The maximum number of pods allowed in the namespace.
Item
Number of Services
The maximum number of Services allowed in the namespace.
Item
Number of load balancer Services
The maximum number of load balancer Services allowed in the namespace.
Item
Number of secrets
The maximum number of secrets allowed in the namespace.
Unit
After you configure the resource quotas, click OK.