Container Limit Ranges
A container can use as much CPU and memory as set by the resource quota for a project. At the same time, KubeSphere uses requests and limits to control resource (for example, CPU and memory) usage for a container, also known as LimitRanges in Kubernetes. Requests make sure the container can get the resources it needs as they are specifically guaranteed and reserved. On the contrary, limits ensure that container can never use resources above a certain value.
When you create a workload, such as a Deployment, you configure resource Kubernetes requests and limits for the container. To make these request and limit fields pre-populated with values, you can set default limit ranges.
This tutorial demonstrates how to set default limit ranges for containers in a project.
Prerequisites
You have an available workspace, a project and a user (project-admin
). The user must have the admin
role at the project level. For more information, see Create Workspaces, Projects, Users and Roles.
Set Default Limit Ranges
-
Log in to the console as
project-admin
and go to a project. On the Overview page, you can see default limit ranges remain unset if the project is newly created. Click Edit Quotas next to Default Container Quotas Not Set to configure limit ranges. -
In the dialog that appears, you can see that KubeSphere does not set any requests or limits by default. To set requests and limits to control CPU and memory resources, use the slider to move to a desired value or enter numbers directly. Leaving a field blank means you do not set any requests or limits.
Note
The limit can never be lower than the request. -
Click OK to finish setting limit ranges.
-
Go to Basic Information in Project Settings, and you can see default limit ranges for containers in a project.
-
To change default limit ranges, click Edit Project on the Basic Information page and select Edit Default Container Quotas.
-
Change limit ranges directly in the dialog and click OK.
-
When you create a workload, requests and limits of the container will be pre-populated with values.
Note
For more information, see Resource Request in Container Image Settings.
See Also
Feedback
Was this page Helpful?
Receive the latest news, articles and updates from KubeSphere
Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.