All Products
Search
Document Center

Container Service for Kubernetes:Manage namespaces and resource quotas

Last Updated:Oct 12, 2023

You can create namespaces to classify cluster resources that are used to complete different tasks. This topic describes how to create namespaces and configure resource quotas and limits in a Container Service for Kubernetes (ACK) cluster.

Prerequisites

Background information

  • In an ACK cluster, you can create multiple namespaces as virtual clusters. If multiple users share a cluster, you can create namespaces to classify cluster resources that are used to complete different tasks and use resource quotas to limit resource allocation in the namespaces.

  • By default, pods that are in the running state can consume the CPU and memory resources of nodes without limit. In this case, pods in a namespace may exhaust the resources of the cluster. Namespaces can be used as virtual clusters to serve multiple purposes. You can also configure resource quotas for namespaces as a best practice. You can configure multiple resource quotas for a namespace, including CPU, memory, and pod quotas. For more information, see resource quotas.

Create a namespace

  1. Log on to the ACK console. In the left-side navigation pane, click Clusters.

  2. On the Clusters page, click the name of the cluster that you want to manage and click Namespaces and Quotas in the left-side navigation pane.

  3. Click Create. In the dialog box that appears, configure namespace parameters and click OK.

    • Name: Enter a name for the namespace. In this example, test is entered. The name must be 1 to 63 characters in length and can contain digits, letters, and hyphens (-). It must start and end with a letter or digit.

    • Label: Add one or more labels to the namespace. Labels are used to identify namespaces. For example, you can label a namespace as one that is used in the test environment.

      To add a label, enter a key and a value. You can click Labels to add more labels.

    Return to the Namespace page. In the list of namespaces, you can view the test namespace that you created.

Configure resource quotas and limits

  1. On the Namespace page, click Resource Quotas and Limits in the Actions column of the namespace that you want to manage.

  2. In the Resource Quotas and Limits dialog box, configure resource quotas and the default resource limits.

    Note

    After you configure CPU and memory quotas for a namespace, you must specify CPU and memory limits when you create a pod. You can also configure the default resource limits for all containers in the namespace. For more information, see resource quotas.

    1. Configure resource quotas for the namespace.

      quota
    2. Configure the default resource limits (limit range) for all containers in the namespace to control resource usage.

What to do next

After you create a namespace, you can perform the following operations on the Namespace page:

  • Click Edit in the Actions column of the namespace to modify the labels of the namespace.

  • Click the More icon in the Actions column of the namespace and then click Delete to delete the namespace. All resources in the namespace are deleted together with the namespace.