From db3f496dfdd1d0d5b636fe7017191c9ce7503063 Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Mon, 11 Mar 2019 23:02:30 -0700 Subject: [PATCH] Container Default Resource Limit --- .../projects-and-namespaces/_index.md | 5 ++++- .../editing-projects/_index.md | 20 ++++++++++++++++++- .../resource-quotas/_index.md | 16 ++++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/_index.md b/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/_index.md index 61acf95e4de..f3b9a3ed3b0 100644 --- a/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/_index.md +++ b/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/_index.md @@ -127,7 +127,10 @@ Rancher extends Kubernetes to allow the application of [Pod Security Policies](h | Namespace Default Limit | The 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. | 1. **Optional:** Repeat these substeps to add more quotas. - + +1. **Optional:** Specify **Container Default Resource Limit**, which will be applied to every container started in the project. The parameter is recommended if you have CPU or Memory limits set by the Resource Quota. It can be overridden on per an individual namespace or a container level. For more information, see [Container Default Resource Limit]({{< baseurl >}}/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/resource-quotas/#setting-container-default-resource-limit) + >**Note:** This option is only available in v2.2.0 and later. + 1. Click **Create**. diff --git a/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/editing-projects/_index.md b/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/editing-projects/_index.md index 20391af00e9..b29cc5d2609 100644 --- a/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/editing-projects/_index.md +++ b/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/editing-projects/_index.md @@ -109,4 +109,22 @@ Edit [resource quotas]({{< baseurl >}}/rancher/v2.x/en/k8s-in-rancher/projects-a 1. 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, Rancher won't let you save your changes. \ No newline at end of file +**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, Rancher won't let you save your changes. + + +## Editing Container Default Resource Limit + +Edit [container default resource limit]({{< baseurl >}}/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/resource-quotas/#setting-container-default-resource-limit) when: + +- You have a CPU or Memory resource quota set on a project, and want to supply the corresponding default values for a container. +- You want to readjust the default container resource limit. + +1. From the **Global** view, open the cluster containing the project to which you want to apply a resource quota. + +1. From the main menu, select **Projects/Namespaces**. + +1. Find the project that you want to add a resource quota to. From that project, select **Ellipsis (...) > Edit**. + +1. Expand **Container Default Resource Limit** and edit the values. + +>**Note:** This option is only available in v2.2.0 and later. diff --git a/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/resource-quotas/_index.md b/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/resource-quotas/_index.md index d07cd9c68a6..948cddcfbe5 100644 --- a/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/resource-quotas/_index.md +++ b/content/rancher/v2.x/en/k8s-in-rancher/projects-and-namespaces/resource-quotas/_index.md @@ -73,8 +73,22 @@ When you create a resource quota, you are configuring the pool of resources avai | Replications Controllers | The maximum number of replication controllers that can exist in the project/namespace. | | Secrets | The maximum number of secrets that can exist in the project/namespace. | ->**1** In the quota, if you set CPU or Memory limits, all containers you create in the project / namespace must explicitly satisfy the quota. See the [Kubernetes documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#requests-vs-limits) for more details. +### Setting Container Default Resource Limit +In the quota, if you set CPU or Memory limits, all containers you create in the project / namespace must explicitly satisfy the quota. See the [Kubernetes documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#requests-vs-limits) for more details. + +To avoid setting the limit on each and every container during a workload creation, default container resource limit can be specified on a project or a namespace level. If set on a project, the parameter will be inherited by every namespace created in the project. + +Once the following container default resource limits are configured either on a project a namespace belongs to, or an individual namespace level, they will be derived and set on every container started in the namespace: + +| Resource Type | Description | +| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| CPU Limit | The maximum amount of CPU (in [millicores](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu)) allocated to the container.| +| CPU Reservation | The minimum amount of CPU (in millicores) guaranteed to the container. | +| Memory Limit | The maximum amount of memory (in bytes) allocated to the container. | +| Memory Reservation | The minimum amount of memory (in bytes) guaranteed to the container. + +>**Note:** This option is only available in v2.2.0 and later. ### Overriding the Default Limit for a Namespace