Subnets
In this article:
Subnets#
General information#
Networking in K2 Cloud features the following properties:
there is L2 + L3 connectivity between instances;
connects to the Internet via the NAT gateway (this cannot be disabled at the moment);
IP addresses are automatically associated with instances according to the selected address block via DHCP protocol;
security groups can be set on network interfaces of instances in VPC;
network ACLs can be set for subnets;
there is IP-connectivity with other subnets in the same VPC;
any network interface, except for the primary one, can be detached from an instance;
external data center networks can be attached.
Instances you create in K2 Cloud can be attached to a subnet and/or to a virtual switch, which is available in one of the availability zones (AZ).
If your project was created after 16.06.2020, you do not need to input specific subnet in web interface or API when creating VM instance in VPC because this instance will be started in default subnet. Default subnets exist in each availability zone. if necessary, you can select default subnet in any availability zone or create subnet yourself.
If you want to start VM instances in default VPC without specifying particular subnet in projects created before 16.06.2020, then create a default subnet. When creating a default subnet, the cloud will assign the first available CIDR block of /20 size to this subnet.
Creating a new subnet#
To create a new subnet:
Go to Virtual machines Networking Subnets and click Create.
In the subnet dialog window, set the following parameters:
The VPC where you need to create a subnet.
(Optional) Name tag.
The subnet address in CIDR notation (<network address>/<network prefix>).
Important
The CIDR block of IP addresses of the subnet being created should be a part of the CIDR block of IP addresses of the VPC. The subnet prefix can have values in the same range as the VPC CIDR block prefixes (16 to 28).
(Optional) The availability zone where you need to create the subnet. If no availability zone is specified, the cloud will automatically select it randomly. Therefore, it is impossible to predict in which zone a subnet will be created.
Automatic Elastic IP association. When this option is enabled, an Elastic IP will be automatically associated with the primary interface of the instance being created in this subnet. The address will be associated if there are available Elastic IPs. If necessary, you can disable automatic association for a particular instance (for details, see setting network parameters when creating an instance).
Important
This option is only applied when creating individual instances, as well as instances in Auto Scaling groups and node groups in EKS clusters.
If you need to set additional tags, go to the next step by clicking Add tags. If the Name tag has not been set, you can specify its value by clicking Add Name tag. To assign an arbitrary tag, click Add tag. Specify the tag key and value.
After setting all the required parameters, click Create subnet.
In the Subnets subsection and on the specific subnet page, you can view which ACL and route table are associated with a subnet, as well as go to the list of instances attached to this subnet.
The first four IP addresses and the last IP address in each subnet CIDR block aren’t available for you to use, and can’t be assigned to an instance. For example, in a 10.0.0.0/24
subnet the first IP address available for you to use is 10.0.0.4
, and 10.0.0.0 — 10.0.0.3
and 10.0.0.255
are reserved by K2 Cloud for technical and future use.
Creating a default subnet#
Since 16.06.2020, default subnets are created automatically along with the default VPC in each availability zone. It may be required to create a default subnet if you deleted it or if your project was created before 16.06.2020
To create a default subnet in the default VPC:
Go to Virtual machines Networking Subnets.
Click the arrow next to Create and select Create a new default subnet.
In the window that opens, select the availability zone where you need to create a default subnet. Only availability zones without a default subnet can be selected.
Important
Only one default subnet can be created in a single availability zone.
A default subnet can only be created in default VPC.
You cannot specify CIDR block yourself. When creating a default subnet, the first available CIDR block of /20 size is assigned to this subnet.
Associating a route table#
Only one route table can be associated with a subnet at a time.
Important
This operation will change traffic routing in the subnet according to the rules of the specified route table.
To associate a subnet with a route table:
Go to Virtual machines Networking Subnets, select the subnet from the list and click Associate with route table.
In the dialog box, select the route table to be associated with the subnet
Click Associate to confirm the action.
Alternatively, to associate a route table with a subnet, go to the subnet page and edit Route table field.
Associating an access control list#
Important
You can associate no more than 200 subnets with a network ACL in a VPC.
To associate a network with an ACL:
Go to Virtual machines Networking Subnets, select the subnet from the list and click Assign ACL.
In the dialog box, select the ACL to be associated with the subnet
Click Associate to confirm the action.
Alternatively, to associate an ACL with a subnet, go to the subnet page and edit the ACL field.
Deleting a subnet#
Note
You can delete a subnet if it doesn’t contain any instances, network interfaces or external networks.
Go to Virtual machines Networking Subnets.
Select the subnet from the list and click Delete.
In the dialog window, confirm the action.
Also, you can delete a subnet on its page. To do this, go to the Information tab, click Delete and confirm the action.
Subnet information#
For general information about existing subnets, see the Subnets subsection. To view the list of all subnets in the project, select All VPC in the VPC filter. To display subnets of a particular VPC, select the desired VPC in the filter.
To view detailed information about a particular subnet, go to Virtual machines Networking Subnets and select the desired subnet from the list. To facilitate the subnet search, select its relevant VPC in the VPC filter or use the search function.
Once you have selected the desired subnet, click its ID. In addition to information about the subnet itself, the subnet page provides details of its attached instances, created interfaces, and assigned tags.
In the Information tab, you can view:
subnet CIDR and the number of free IP addresses;
VPC and availability zone in which the subnet is located;
the number of attached instances and network interfaces;
assigned ACL and associated route table, as well as other parameters;
Here you can also:
enable/disable Elastic IP auto-association option;
associate another route table with the subnet by editing the corresponding field;
associate another access control list with the subnet by editing the corresponding field.
The Subnet tab displays a list of instances attached to the subnet.
The Network Interfaces tab displays a list of network interfaces created in the subnet. For more information on network interface operations, please see Network Interfaces.
In the Tags tab, you can view tags assigned to the subnet. Here, you can also add,change and delete tags of the subnet.