Managing Namespaces

Using Namespaces

Isolating Namespaces

Managing Namespace Labels

  1. Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane, choose Namespaces.
  2. Locate the row containing the target namespace and choose More > Manage Label in the Operation column.
  3. In the dialog box that is displayed, the existing labels of the namespace are displayed. Modify the labels as needed.

    • Adding a label: Click the add icon, enter the key and value of the label to be added, and click OK.

      For example, the key is project and the value is cicd, indicating that the namespace is used to deploy CICD.

    • Deleting a label: Click next the label to be deleted and then OK.

  4. Switch to the Manage Label dialog box again and check the modified labels.

Enabling Node Affinity in a Namespace

After node affinity is enabled in a namespace, the workloads newly created in the namespace can be scheduled only to nodes with specific labels. For details, see PodNodeSelector.

  1. Log in to the CCE console and click the cluster name to access the cluster console. In the navigation pane, choose Namespaces.
  2. Locate the target namespace and click in the Node Affinity column.
  3. In the displayed dialog box, select Enable and click OK.

    After node affinity is enabled, new workloads in the current namespace will be scheduled only to nodes with specified labels. For example, in namespace test, the workloads in the namespace can be scheduled only to the node whose label key is kubelet.kubernetes.io/namespace and label value is test.

  4. You can add specified labels to a node in Labels and Taints on the Nodes page. For details, see Managing Node Labels.

Deleting a Namespace

If a namespace is deleted, all resources (such as workloads, jobs, and ConfigMaps) in this namespace will also be deleted. Exercise caution when deleting a namespace.

  1. Log in to the CCE console and click the cluster name to access the cluster console.
  2. Choose Namespaces in the navigation pane. On the displayed page, click More in the row of the target namespace and choose Delete.

    Follow the prompts to delete the namespace. The default namespaces cannot be deleted.