A namespace is a collection of resources and objects. Multiple namespaces can be created inside a cluster and isolated from each other. This enables namespaces to share the same cluster Services without affecting each other.
For example, you can deploy workloads in a development environment into one namespace, and deploy workloads in a testing environment into another namespace.
At least one cluster has been created.
A maximum of 6000 Services can be created in each namespace. The Services mentioned here indicate the Kubernetes Service resources added for workloads.
Namespaces can be created automatically or manually.
Parameter |
Description |
---|---|
Name |
Unique name of the created namespace. |
Description |
Description about the namespace. |
Quota Management |
Resource quotas can limit the amount of resources available in namespaces, achieving resource allocation by namespace. NOTICE:
You are advised to set resource quotas in the namespace as required to prevent cluster or node exceptions caused by resource overload. For example, the default number of pods that can be created on each node in a cluster is 110. If you create a cluster with 50 nodes, you can create a maximum of 5,500 pods. Therefore, you can set a resource quota to ensure that the total number of pods in all namespaces does not exceed 5,500. Enter an integer. If the quota of a resource is not specified, 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. |
Define a namespace.
apiVersion: v1 kind: Namespace metadata: name: custom-namespace
Run the kubectl command to create it.
$ kubectl create -f custom-namespace.yaml namespace/custom-namespace created
You can also run the kubectl create namespace command to create a namespace.
$ kubectl create namespace custom-namespace namespace/custom-namespace created