Managing Namespaces
Namespaces created on the cluster console apply only to the current cluster. You can create workloads and jobs in these namespaces. In addition, you can manage resource quotas in namespaces or delete namespaces. However, all operations apply only to the current cluster.
- The default namespace created by MCP supports quota management but cannot be deleted.
- Namespaces created by a cluster, such as karmada-cluster, kube-public, and kube-system, do not support quota management and cannot be deleted.
Namespace Types
Namespaces are classified into four types based on creation types:
- Default namespace created by MCP, namely, default. The default namespace is used if no namespace is specified.
- Default namespaces created by a cluster, namely, kube-public, kube-system, and karmada-cluster.
- kube-public: used to deploy public add-ons and container templates.
- kube-system: used to deploy Kubernetes system components.
- karmada-cluster: used to deploy system components.
- Namespaces created by users on the MCP console.
- Namespaces created by users on the cluster console. These namespaces apply only to the current cluster.
Creating a Namespace
- Log in to the cluster console. In the left navigation pane, choose Cluster Overview.
- On the page displayed, click Namespaces and then Create Namespace. Configure parameters.
- Namespace Name: Name of the namespace, which must be unique in a cluster.
- Cluster: Name of the current cluster, which cannot be changed.
- Description: Description of the namespace.
- Manage Quota: Resource quotas can limit the amount of resources available in namespaces, achieving resource allocation by namespace.
- After this option is enabled, you can set resource quotas on this page.
- If you do not enable this option, you need to click Manage Quota in the namespace list to set resource quotas after the namespace is created.
- Click OK.
Deleting a Namespace
On the cluster console, you can delete only the namespaces created for the current cluster. If a namespace created on the MCP console is deleted on the cluster console, it will be re-created.
Deleting a namespace will delete all data resources related to the namespace. Exercise caution when performing this operation.
- Log in to the cluster console. In the left navigation pane, choose Cluster Overview. On the page displayed, click Namespaces.
- In the row where the namespace to be deleted resides, click Delete.
Setting Resource Quotas in a Namespace
Resource quotas can limit the amount of resources available in namespaces, achieving resource allocation by namespace.
Namespace-level resource quotas limit the amount of resources available to teams or users when these teams or users use the same cluster. The quotas include the total number of a type of objects and the total amount of compute resources (CPU and memory) consumed by the objects.
- Log in to the cluster console. In the left navigation pane, choose Cluster Overview. Then click Namespaces.
- In the Operation column of a namespace, click Manage Quota.
The kube-public, kube-system, and karmada-cluster namespaces do not support resource quota settings.
- Click Edit Quota, set the resource quotas, and click OK.
- The values of resource quotas are integers. If the quota of a resource is set to 0, no limit is posed on the resource. If you want to limit the CPU or memory quota, you must specify the CPU or memory request value when creating a workload.
- Accumulated quota usage includes the default resources created by the system, such as the Kubernetes Service (view this Service using the kubectl tool) created in the default namespace. Therefore, you are advised to set a resource quota greater than what you expect.
- CPU (cores): Maximum number of CPU cores that can be allocated to workload pods in the namespace. Unit: cores.
- Memory (MiB): Maximum amount of memory that can be allocated to workload pods in the namespace. Unit: MiB.
- StatefulSet: Maximum number of StatefulSets that can be created in the namespace.
- Deployment: Maximum number of Deployments that can be created in the namespace.
- Job: Maximum number of jobs that can be created in the namespace.
- Cron Job: Maximum number of cron jobs that can be created in the namespace.
- Pod: Maximum number of pods that can be created in the namespace.
- Service: Maximum number of Services that can be created in the namespace.
Last Article: Managing Node Labels
Next Article: Workload Management
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.