Skip to main content
Version: 1.1.0

Manage Resources

This topic describes how to set quotas for limits and requests for CPU, memory, ephemeral storage, and pod count for each application namespace on a slice.

Overview

Resource quotas enable the cluster admins to enforce limits for CPU, memory, ephemeral storage and number of application pods per namespace on a slice. It requires setting and monitoring the threshold limit and requests of the resources at the slice level.

The cluster admin can manage the usage of compute resources on a slice ensuring that the namespaces get a fair share of the resources. This prevents some namespaces from overusing the resources leaving little or no resources for other namespaces on the same slice.

Requests and limits are the ways Kubernetes uses to manage resources such as CPU and memory. Requests are what the container is assured to get. Limits ensure that a container is restricted to a particular value. You can also set quotas for requests and limits to manage the local ephemeral storage.

A default limit and request can be configured per container and their purpose is described below:

  • Default limit per container: This is used for a container in the namespace that does not have resource limits configured. The default limit per container is set at the namespace level.
  • Default request per container: This is used for a container in the namespace that does not have resource requests configured. A default request per container can be set at the slice quota that applies to all namespaces on the slice. This default request per container set at the slice level is overridden when it is set at the namespace level.

Prerequisites

Before you begin, ensure that the following prerequisites are met:

  • You have read and write access to the cluster connected to the slice on which you would 8 set the quotas for limits and requests.
  • Namespaces are onboarded onto the slice.

Set Resource Quotas

Set the resource limits and requests for CPU, ephemeral storage, memory, and the maximum number of pod count per slice.

  1. Go to Resource Quotas on the left sidebar.

  2. On the Resource Quotas page, the slices with namespaces onboarded are listed.

    For the slices that have quota configured, the corresponding limits and requests are represented. The green mark against a slice indicates that quotas have been enforced on some of the namespaces on the slice.

    alt

  3. (Optional) Check the cluster details for each slice by expanding its menu.

    alt

  4. Select the slice for which you want to configure the limits. The Add Resource Quota button is enabled.

    alt

  5. Click Add Resource Quota.

  6. Configuring resource quota is divided into four steps as described below.

Step 1 - Set Slice Quotas

The first step is to set the quotas for limits and requests at the slice level for all worker clusters on a given slice.

info

The quotas for limits and requests are only monitored and not enforced at the slice level. When the usage exceeds a quota, its value is in red.

To set the quotas for limits and requests at the slice level:

  1. On the Resource Quotas page, go to Step 1 - Set slice quotas tab.

  2. On the Step 1 - Set slice quotas tab, under the slice, click the value below No. of Pods.

    info

    The usage values are in the numerator for pod count, CPU, memory, and ephemeral storage.

  3. In the text box, set the limit for the maximum number of pods that can be on this slice. While adding the limits, set the value in the denominator of the fraction. This will be the cumulative sum of the pods on all the namespaces on the slice.
    The numerator in the fraction represents the usage.

    alt

  4. Add quota for CPU request if you want to set the CPU requests for all the namespaces on the slice. If you set CPU requests, you must set the request per container in the text box that is below CPU Requests. Ensure that the quota for request per container is less than or equal to the CPU request that you set.

    info

    If you set request for a resource, you must set the corresponding request per container. Ensure that the quotas for requests and request per container for a resource are not more than the corresponding limits.

    The request per container for a resource must be less than or equal to the quotas for the corresponding limit and request.

  5. Similarly, add quota for the memory and ephemeral storage limits and requests based on the applications that are onboarded onto the slice.

    alt

  6. Click Next to go to step 2.

Step 2 - Set Namespace Quotas

The second step is to enforce the limits and requests for one or more namespaces as required.

info

The quotas that are set are enforced at the namespace level. New pods are not spawned if the quotas reaches the threshold or about to reach the threshold.

To enforce the quotas for limits and requests on a namespace:

  1. On the Step 2 - Enforce quotas tab, scroll down to Manage Resources that contains the namespaces listed.

  2. For the namespace that you want to set quotas for limits and requests, under Enforce, turn on the toggle key. If there are many namespaces on your slice, use the search field to look for the namespace that you want to enforce quotas.

    alt

  3. Set the limits and requests for No of Pods, CPU, Memory and Ephemeral Storage.

    info

    In this step, if you set the limit for a resource, then you must set the limit per container for the corresponding resource. If you set the request for a namespace, the request per container is required only if the corresponding request per container is not set under the slice quota.

    For a given resource:

    • The limits for all namespaces must not exceed the corresponding limit under the slice quota.
    • The requests for all namespaces must not exceed the corresponding request under the slice quota.
    • The limit per container for a namespace must be less than or equal to the corresponding limit for that namespace.
    • The request for a namespace is less than or equal to the corresponding limit for that namespace.
    • The request per container for a namespace is less than the corresponding request and the limit per container for that namespace.
    • The request per container for a namespace overrides the corresponding value set under the slice quota.

    alt

  4. Alternatively, you can skip this step if you want to only have quotas for the slice for monitoring purposes.

  5. Click Next to go to the step 3.

Step 3 - Apply YAML

The step 3 is to verify the autogenerated YAML file and apply it to save the configuration.

To apply the YAML file:

  1. On the Step 3 - Generate YAML and Apply tab, verify the limits and requests that you have set for the slice and namespaces.

  2. (Optional) Download the YAML file by clicking the download button.

  3. The Code Preview that is towards the bottom of the page provides a preview of the SliceResourceQuotaConfig YAML file that you have set in the previous two steps.

    alt

  4. Click the Apply YAML button to save the configuration.

  5. Click Next to finalize the changes in the step 4.

Step 4 - Finalize Resource Quotas

To finalize the quotas for limits and requests that you have configured:

  1. On the Step 4 - Finalize tab, scroll down to verify the slice and namespace quotas for limits and requests that you have set.

    alt

  2. (Optional) If you want to make any changes, you can go back to the previous steps to do the changes and apply the YAML again.

  3. Click Done to confirm the configuration. The slice on which you just configured the quotas for limits and requests is listed on the Resource Quotas page.

    alt

Edit Resource Quotas

You can edit the quotas for limits and requests for a slice as per the business and application needs that results in onboarding new namespaces and so on.

To edit the quota limits and requests for a slice:

  1. Go to Resource Quotas on the left sidebar.

  2. On the Resource Quotas page, select the slice for which you want to edit the quotas for limits and requests.

    alt

  3. Click the Edit Resource Quota button.

  4. On the *Resource Quotas page, start editing with the first step that is editing the slice quotas. Editing the quotas for limits and requests involves the same four steps, which you had performed when you set them.

Step 1 - Edit Slice Quotas

To edit the slice quotas for limits and requests:

  1. On the Step 1 - Set slice quotas tab, edit the pod count (only limit), CPU, and memory limits and requests.

    alt

  2. Click Next.

Step 2 - Edit Namespace Quotas

To edit the namespace quotas for limits and requests:

  1. On the Step 2 - Enforce quotas tab, edit the existing quotas for limits and requests for the enforced namespaces.

    info

    In this step, if you set the limit for a resource, then you must set the limit per container for the corresponding resource. If you set the request for a namespace, the request per container is required if the corresponding request per container is not set under the slice quota.

    For a given resource:

    • The limits for all namespaces must not exceed the corresponding limits under the slice quota.
    • The requests for all namespaces must not exceed the corresponding requests under the slice quota.
    • The limit per container for a namespace must be less than or equal to the corresponding limit for that namespace.
    • The request for a namespace is less than or equal to the corresponding limit for that namespace.
    • The request per container for a namespace is less than the corresponding request and the limit per container for that namespace.
    • The request per container for a namespace overrides the corresponding value set under the slice quota.

    alt

  2. (Optional) Set the pod count, CPU, and memory quotas for limits and requests for namespaces that are newly added, or that were skipped earlier.

  3. After you are done with editing the quotas for limits and requests, click Next to go to step 3.

Step 3 - Apply YAML

Verify the autogenerated YAML file and apply it to save the configuration.

To apply the YAML file:

  1. On the Step 3 - Generate YAML and Apply tab, under Code Preview, verify the autogenerated file. You can also download the YAML file by clicking the download button.

    alt

  2. Click Apply YAML to save the configuration.

  3. Click Next to go to step 4.

Step 4 - Finalize Resource Quotas

Finalize and confirm the edited quotas for limits and requests.

To finalize the edited quotas for limits and requests:

  1. On the Step 4 - Finalize tab, scroll down to verify the slice and namespace limits and requests that you have set.

    alt

  2. (Optional) If you want to make any changes, you can go back to the previous steps to do the changes and apply the YAML file again.

  3. Click Done to confirm the updated configuration. The slice on which you just updated quotas for limits and requests, is listed on the Resource Quotas page.

Delete Namespace Quotas

  1. Go to Resource Quotas on the left sidebar.

  2. On the Resource Quotas page, select the slice that contains the namespaces for which you want to delete quotas for limits and requests.

    alt

  3. Click the Edit Resource Quota button.

  4. On the Step 1 - Set slice quotas tab, click Next.

  5. On the Step 2 - Enforce quotas tab, scroll down to Resource Quotas below the slice quota details.

  6. Under Resource Quotas, click Clear against the namespace that you want to remove quotas from.

    alt

  7. (Optional) Turn off the toggle key below Enforce for the namespace to keep it from being monitored.

  8. The system warns you that by turning off the toggle key, the quotas enforced on the namespace will be turned off. The warning also asks if that namespace needs to be monitored. Confirm or deny monitoring of that namespace.

  9. Similarly, click the Clear button or turn off the enforced quota for other namespaces on the slice as required.

  10. After removing the quotas for limits and requests, click Next to apply the YAML file.

  11. On the Step 3 - Generate YAML and Apply tab, verify the new autogenerated YAML file. You can also download the YAML file by clicking the download button.

    alt

  12. Click Apply YAML to save the configuration.

  13. Click Next to finalize the changes.

  14. On the Step 4 - Finalize tab, verify the namespace for which you had deleted the quotas for limits and requests.

  15. Click Done to confirm the changes.

Delete Slice Quotas

  1. Go to Resource Quotas on the left sidebar.

  2. On the Resource Quotas page, select the slice for which you want to delete the quotas for limits and requests.

    alt

  3. Click the Edit Resource Quota button.

  4. On the Step 1 - Set slice quotas tab, click Clear all values that is toward the top-right corner of the slice quota details.

    alt

  5. The system warns you that all the quotas set on the slice will be removed. Confirm that you want to delete.

  6. Confirming deletion takes you to Step 3 - Apply YAML.

    alt

  7. Click Apply YAML to apply the slice quotas deletion.

  8. Click Next to finalize the deletion.

  9. On the Step 4 - Finalize tab, click Done.

    alt

  10. The quotas for limits and requests set for the slice are deleted, and you are redirected to the Manage Resources page.

    The slice for which you just removed the quotas for limits and requests is listed.

    alt