Namespaces enable division of cluster resources and objects among multiple users. Typically, namespaces are best suited for scenarios where a large number of users work across multiple projects. Multiple namespaces can be created in a single cluster with the data isolated from each other. This enables namespaces to share the services of the same cluster without affecting each other.
For example, you can deploy applications in a development environment in one namespace, and deploy applications in a test environment in another namespace.
You have created at least one cluster. For details, see Creating a VM Cluster.
Namespaces can be created automatically or manually.
Before being released, an application generally goes through the phases of development, joint debugging, testing, and production. You can create different clusters or different namespaces in the same cluster.
Resources cannot be shared among different clusters. A load balancer is required in order to enable mutual access between services in different environments.
Applications in the same namespace access each other using service names, while applications in different namespaces access each other using service names and namespace names.
Figure 1 shows namespaces respectively created for the development, joint debugging, and testing environments.
You are advised to use this method if a large number of applications are deployed in the same environment. As shown in the following figure, different namespaces are created for App 1 and App 2. Applications in a namespace are managed as an application group. Applications in the same namespace access each other using service names, while applications in different namespaces access each other using service names and namespace names.
If a namespace is deleted, all resources (such as applications, one-off jobs, and ConfigMaps) in this namespace will be also deleted. Exercise caution when deleting a namespace.
Follow the prompts to delete the namespace. The built-in namespaces of the system cannot be deleted.