Namespace
Namespaces are used to logically divide your resources into different groups, especially in scenarios where a large number of users work across multiple projects.
Currently, CCI provides general-computing resources. When creating a namespace, you must choose a resource type so that workloads you create can run in the corresponding cluster.
- General-computing: Pods with vCPUs can be created, which are ideal for general computing scenarios.
- One account can create a maximum of five namespaces in one region.
- General-computing resources support x86-based images.
Relationship Between Namespaces and Networks
Each namespace requires a separate subnet, as shown in Figure 1. When you create a namespace, you need to associate it with an existing VPC or a new VPC. If you create a VPC, create a subnet for the namespace. Containers and other resources created in this namespace will run in the VPC and subnet you select.
If you want to run resources of multiple services in the same VPC, you need to consider network planning, including subnet CIDR block division and IP address planning.
Application Scenarios
Namespaces can implement partial environment isolation. If you have a large number of projects and personnel, you can create different namespaces based on project attributes, such as production, test, and development.
Creating a Namespace
- Log in to the CCI console. In the navigation pane on the left, choose Namespaces.
- On the page displayed on the right, click Create for the target namespace type.
- Enter a name for the namespace.
The namespace name must be globally unique in CCI.
- Set RBAC policies.
After RBAC is enabled, the access to resources in the namespace is controlled by the RBAC policies. For details, see Namespace Permissions.
- Select an enterprise project. In CCI, each namespace can belong to one enterprise project, but an enterprise project can have multiple namespaces.
- Skip this step if Enterprise Project Management Service is not enabled. To enable the service, see Enabling Enterprise Center. If you are an IAM user, pay attention to the notice provided in (Optional) Uploading Images.
- After you specify an enterprise project, both the namespace and the network and storage resources that are automatically created for the namespace belong to the enterprise project. You must migrate these resources together with the namespace. For example, when you migrate a namespace from project 1 to project 2, you must also migrate the associated network and storage resources to project 2, or the workloads in this namespace may not run normally.
- Configure a VPC.
You can use an existing VPC or create a VPC. If you create a VPC, it is recommended that you set the VPC CIDR block to 10.0.0.0/8–22, 172.16.0.0/12–22, or 192.168.0.0/16–22.
You must not set the VPC CIDR block and subnet CIDR block to 10.247.0.0/16, because this CIDR block is reserved for workload access. If you select this CIDR block, IP address conflicts may occur, which may result in failure to create a workload or service unavailability. If you do not need to access pods through workloads, you can select this CIDR block.
After the namespace is created, you can view VPC and subnet information by choosing Network Management > Networks.
- Configure a subnet CIDR block.
Ensure sufficient available IP addresses to create workloads.
Figure 2 Configuring a subnet
- Some IP addresses (10 by default) in the configured subnet will be warmed up for the created namespace.
- You can set the number of IP addresses to be warmed up in 8.
- Warming up IP addresses for the created namespace affects the deletion of the configured subnet and VPC. They can be deleted only after the namespace is deleted.
- Configure advanced settings.
Each namespace provides an IP resource pool. You can customize the pool size to reduce the duration for applying for IP addresses and improve the workload creation efficiency.
For example, 200 pods are running every day. During peak traffic hours, the IP resource pool instantly scales out to provide 500 IP addresses. After a specified interval (for example, 23 hours), the number of IP addresses that exceed the pool size (500 – 200 = 300) will be reclaimed.
Figure 3 Configuring advanced settings
- IP Pool Warm-up for Namespace: CCI creates an IP pool with the number of IP addresses you specify here for the namespace, and will warm up these IP addresses to accelerate workload creation. The IP pool can contain a maximum of 500 IP addresses.
- IP Address Recycling Interval (h): Warmed-up IP addresses that become idle can be recycled within the duration that you specify here.
- Container Network: Enable this option if you want CCI to start the container network in advance so that containers can connect to the network as soon as they are started.
- Click Create.
After the creation is complete, you can view the VPC and subnet information on the namespace details page.
Deleting a Namespace
Deleting a namespace will remove all data resources related to the namespace, including workloads, ConfigMaps, secrets, and SSL certificates.
- Log in to the CCI console. In the navigation pane on the left, choose Namespaces. On the page displayed, click the namespace you want to delete.
- In the upper right corner, click Delete. In the dialog box that is displayed, enter DELETE and click Yes.
To delete a VPC or subnet, go to the VPC console.
Creating a Namespace Using kubectl
For details, see Namespace and Network.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot