跳到主要内容
版本:v2.0-v2.4

Project Resource Quotas

Available as of v2.1.0

In situations where several teams share a cluster, one team may overconsume the resources available: CPU, memory, storage, services, Kubernetes objects like pods or secrets, and so on. To prevent this overconsumption, you can apply a resource quota, which is a Rancher feature that limits the resources available to a project or namespace.

This page is a how-to guide for creating resource quotas in existing projects.

Resource quotas can also be set when a new project is created. For details, refer to the section on creating new projects.

Resource quotas in Rancher include the same functionality as the native version of Kubernetes. In Rancher, resource quotas have been extended so that you can apply them to projects. For details on how resource quotas work with projects in Rancher, refer to this page.

Applying Resource Quotas to Existing Projects

Available as of v2.0.1

Edit resource quotas when:

  • You want to limit the resources that a project and its namespaces can use.
  • You want to scale the resources available to a project up or down when a resource quota is already in effect.
  1. From the Global view, open the cluster containing the project to which you want to apply a resource quota.

  2. From the main menu, select Projects/Namespaces.

  3. Find the project that you want to add a resource quota to. From that project, select > Edit.

  4. Expand Resource Quotas and click Add Quota. Alternatively, you can edit existing quotas.

  5. Select a Resource Type. For more information on types, see the quota type reference.

  6. Enter values for the Project Limit and the Namespace Default Limit.

    FieldDescription
    Project LimitThe overall resource limit for the project.
    Namespace Default LimitThe default resource limit available for each namespace. This limit is propagated to each namespace in the project. The combined limit of all project namespaces shouldn't exceed the project limit.
  7. Optional: Add more quotas.

  8. Click Create.

Result: The resource quota is applied to your project and namespaces. When you add more namespaces in the future, Rancher validates that the project can accommodate the namespace. If the project can't allocate the resources, you may still create namespaces, but they will be given a resource quota of 0. Subsequently, Rancher will not allow you to create any resources restricted by this quota.