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 (e.g. 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 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.
You have an available workspace, a project and an account (
project-admin). The account must have the
admin role at the project level. For more information, see Create Workspaces, Projects, Accounts and Roles.
Set Default Limit Ranges
Log in to the console as
project-adminand go to a project. On the Overview page, you can see default limit ranges remain unset if the project is newly created. Click 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 input numbers directly. Leaving a field blank means you do not set any requests or limits.
NoteThe limit can never be lower than the request.
Click OK to finish setting limit ranges.
Go to Basic Info in Project Settings, and you can see default limit ranges for containers in a project.
To change default limit ranges, click Manage Project on the Basic Info page and select Edit Resource Default Request.
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.
NoteFor more information, see Resource Request in Container Image Settings.