Merge pull request #831 from Sherlock113/resourcequota

Add project quota and limit range ranges
This commit is contained in:
Sherlock113 2021-01-18 11:57:44 +08:00 committed by GitHub
commit d59c53ae2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 118 additions and 10 deletions

View File

@ -0,0 +1,59 @@
---
title: "Container Limit Ranges"
keywords: 'Kubernetes, KubeSphere, resource, quotas, limits, requests, limit ranges, containers'
description: 'How to set default container limit ranges.'
linkTitle: "Container Limit Ranges"
weight: 13400
---
A container can use as much CPU and memory as set by [the resource quota for a project](../../workspace-administration/project-quotas/). 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](https://kubernetes.io/docs/concepts/policy/limit-range/) 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.
## Prerequisites
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 Workspace, Project, Account and Role](../../quick-start/create-workspace-and-project/).
## Set Default Limit Ranges
1. 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 **Set** to configure limit ranges.
![limit-ranges](/images/docs/project-administration/container-limit-ranges/limit-ranges.jpg)
2. 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.
![default-limit-range](/images/docs/project-administration/container-limit-ranges/default-limit-range.jpg)
{{< notice note >}}
The limit can never be lower than the request.
{{</ notice >}}
3. Click **OK** to finish setting limit ranges.
4. Go to **Basic Info** in **Project Settings**, and you can see default limit ranges for containers in a project.
![view-limit-ranges](/images/docs/project-administration/container-limit-ranges/view-limit-ranges.jpg)
5. To change default limit ranges, click **Manage Project** on the **Basic Info** page and select **Edit Resource Default Request**.
![change-limit-range](/images/docs/project-administration/container-limit-ranges/change-limit-range.jpg)
6. Change limit ranges directly in the dialog and click **OK**.
7. When you create a workload, requests and limits of the container will be pre-populated with values.
![workload-values](/images/docs/project-administration/container-limit-ranges/workload-values.jpg)
{{< notice note >}}
For more information, see **Resource Request** in [Container Image Settings](../../project-user-guide/application-workloads/container-image-settings/).
{{</ notice >}}
## See Also
[Project Quotas](../../workspace-administration/project-quotas/)

View File

@ -1,10 +0,0 @@
---
title: "Project Quotas"
keywords: 'kubernetes, docker, helm, jenkins, istio, prometheus'
description: 'Project Quotas'
linkTitle: "Project Quotas"
weight: 13400
---
TBD

View File

@ -0,0 +1,59 @@
---
title: "Project Quotas"
keywords: 'KubeSphere, Kubernetes, projects, quotas, resources, requests, limits'
description: 'How to set project quotas.'
linkTitle: "Project Quotas"
weight: 9600
---
KubeSphere uses requests and limits to control resource (e.g. CPU and memory) usage in a project, also known as [ResourceQuotas](https://kubernetes.io/docs/concepts/policy/resource-quotas/) in Kubernetes. Requests make sure a project can get the resources it needs as they are specifically guaranteed and reserved. On the contrary, limits ensure that a project can never use resources above a certain value.
Besides CPU and memory, you can also set resource quotas for other objects separately such as Pods, [Deployments](../../project-user-guide/application-workloads/deployments/), [Jobs](../../project-user-guide/application-workloads/jobs/), [Services](../../project-user-guide/application-workloads/services/) and [ConfigMaps](../../project-user-guide/configuration/configmaps/) in a project.
This tutorial demonstrates how to configure quotas for a project.
## Prerequisites
You have an available workspace, a project and an account (`ws-admin`). The account must have the `admin` role at the workspace level. For more information, see [Create Workspace, Project, Account and Role](../../quick-start/create-workspace-and-project/).
{{< notice note >}}
If you use the account `project-admin` (an account of the `admin` role at the project level), you can set project quotas as well for a new project (i.e. its quotas remain unset). However, `project-admin` cannot change project quotas once they are set. Generally, it is the responsibility of `ws-admin` to set limits and requests for a project. `project-admin` is responsible for [setting limit ranges](../../project-administration/container-limit-ranges/) for containers in a project.
{{</ notice >}}
## Set Project Quotas
1. Log in to the console as `ws-admin` and go to a project. On the **Overview** page, you can see project quotas remain unset if the project is newly created. Click **Set** to configure quotas.
![project-quotas](/images/docs/workspace-administration/project-quotas/project-quotas.jpg)
2. In the dialog that appears, you can see that KubeSphere does not set any requests or limits for a project 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.
![set-project-quotas](/images/docs/workspace-administration/project-quotas/set-project-quotas.jpg)
{{< notice note >}}
The limit can never be lower than the request.
{{</ notice >}}
3. To set quotas for other resources, click **Add quota item** and select an object from the list.
![set-other-resouce-quotas](/images/docs/workspace-administration/project-quotas/set-other-resouce-quotas.jpg)
4. Click **OK** to finish setting quotas.
5. Go to **Basic Info** in **Project Settings**, and you can see all resource quotas for the project.
![resrouce-quotas](/images/docs/workspace-administration/project-quotas/resrouce-quotas.jpg)
6. To change project quotas, click **Manage Project** on the **Basic Info** page and select **Edit Quota**.
![edit-quotas](/images/docs/workspace-administration/project-quotas/edit-quotas.jpg)
7. Change project quotas directly on the **Project Quota** page and click **OK**.
## See Also
[Container Limit Ranges](../../project-administration/container-limit-ranges/)

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB