VCI supports creating instances using the default subnet or a specified subnet. This topic describes the steps of creating a VCI based on a specified subnet.
Background information
If no subnet is specified, the system uses the default subnet, that is, the pod subnet specified during cluster creation.
Usage limits
- The availability zone to which the subnet belongs must already have a virtual node.
- After the instance is created, its subnet cannot be changed.
Prerequisites
- A VPC and its subnet have been created. For details, see Creating VPCs.
Using the Kubernetes approach
When creating a pod or workload (including Deployment, StatefulSet, Job, or CronJob), specify the subnet by adding an annotation.
The annotation description is as follows.
The following sample code shows how to create a Deployment.
Using the console
Similarly, specify the subnet by adding an annotation when creating a workload.
The following figure shows how to create a stateless workload (Deployment). The procedure for creating other workloads is similar. For detailed steps of creating workloads, see Workloads. tip
VCI does not support DaemonSets. For more information, see Limits. Querying the subnet of an instance
Obtain the ID of the subnet used by the VCI by using the pod annotation.