Creating a node group
To create a node group, create a Managed Service for Kubernetes cluster first and make sure that the cloud has enough free resources.
Create a node group
To create a Managed Service for Kubernetes node group:
-
In the management console
, select the folder to create your Managed Service for Kubernetes cluster in. -
In the list of services, select Managed Service for Kubernetes.
-
Select the Managed Service for Kubernetes cluster to create a node group for.
-
On the Managed Service for Kubernetes cluster page, go to the Nodes manager tab.
-
Click Create a node group.
-
Enter a name and description for the Managed Service for Kubernetes node group.
-
In the Kubernetes version field, select a Kubernetes version for Managed Service for Kubernetes nodes.
-
In the Container runtime field, select
Docker
orcontainerd
. -
Under Scaling, select its type:
-
Fixed
: Number of Managed Service for Kubernetes nodes in the group remains constant. Specify the number of Managed Service for Kubernetes nodes in the group.The Number of nodes setting will become available.
-
Automatic
: To control the number of group nodes via the Managed Service for Kubernetes cluster autoscaling.The following settings will become available:
- Minimum number of nodes.
- Maximum number of nodes.
- Initial number of nodes with which the Managed Service for Kubernetes group will be created.
Warning
You cannot change the scaling type after you create your Managed Service for Kubernetes node group.
-
-
Under Allow when creating and updating, specify the maximum number of VM instances that you can exceed and reduce the size of the Managed Service for Kubernetes node group by.
-
Under Computing resources:
-
Choose a platform.
-
Enter the required number of GPUs and vCPUs, guaranteed vCPU performance, and the amount of RAM.
-
(Optional) Specify that you want the VM to be preemptible.
-
(Optional) Enable a software-accelerated network.
Warning
Before activating a software-accelerated network, make sure that you have sufficient cloud resources available to create an additional Managed Service for Kubernetes node.
Note
The set of parameters depends on the platform you select.
-
-
(Optional) Under GPU settings, specify if the Managed Service for Kubernetes node group should have no pre-installed NVIDIA® drivers and CUDA® libraries for GPU acceleration.
-
(Optional) Under Placement, enter a name for the Managed Service for Kubernetes node placement group. This setting cannot be changed after the Managed Service for Kubernetes node group is created.
-
Under Storage:
-
Specify the Managed Service for Kubernetes node Disk type:
-
HDD
: Standard network drive; network block storage on an HDD. -
SSD
: Fast network drive; network block storage on an SSD. -
Non-replicated SSD
: Network drive with enhanced performance achieved by removing redundancy. You can only change the size of this type of disk in 93 GB increments.Alert
Non-replicated disks have no redundancy. If a disk fails, its data will be irretrievably lost. For more information, see Non-replicated disks and high-performance SSDs.
-
SSD IO
: Network drive with the same performance characteristics asNon-replicated SSD
, plus redundancy. You can only change the size of this type of disk in 93 GB increments.
-
-
Specify the Managed Service for Kubernetes node disk size.
-
-
Under Network settings:
-
In the Public address field, choose a method for assigning an IP address:
Auto
: Assign a random IP address from the Yandex Cloud IP pool.No address
: Do not assign a public IP address.
-
Select security groups.
Warning
The configuration of security groups determines cluster performance, availability, and services running in the cluster.
-
Specify how Managed Service for Kubernetes nodes should be distributed across the availability zones and networks.
-
(Optional) Click Add location and specify an additional availability zone and network to create Managed Service for Kubernetes nodes in different zones.
-
-
Under Access, specify the information required to access the Managed Service for Kubernetes node:
- Enter the username in the Login field.
- In the SSH key field, paste the contents of the public key file.
-
Under Maintenance window settings:
- In the Maintenance frequency / Disable field, select your preferred maintenance window:
Disabled
: Automatic updates disabled.Anytime
: Updates allowed at any time.Daily
: Updates will take place within the time interval specified in the Time (UTC) and duration field.On selected days
: Updates will take place within the time interval specified in the Weekly schedule field.
- In the Maintenance frequency / Disable field, select your preferred maintenance window:
-
Under Additional:
- To be able to edit unsafe kernel parameters on the Managed Service for Kubernetes group nodes, click Add variable. To enter the name of each kernel parameter, create a separate field.
- To set up taint policies for Managed Service for Kubernetes nodes, click Add policy. Enter the key, value, and effect of each taint policy in a separate set of fields.
- To set up Kubernetes labels for group nodes, click Add label. Enter the key and value of each Kubernetes label in a separate set of fields.
-
Click Create.
Creating a group of Managed Service for Kubernetes nodes may take a few minutes depending on the number of nodes.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
Check the description of the CLI command for creating a Managed Service for Kubernetes node group:
yc managed-kubernetes node-group create --help
-
Specify Managed Service for Kubernetes node group parameters in the create command (we excluded some supported parameters from the example for brevity).
yc managed-kubernetes node-group create \ --allowed-unsafe-sysctls=<names_of_unsafe_kernel_parameters> \ --cluster-name <cluster_name> \ --cores <number_of_vCPUs> \ --core-fraction <guaranteed_vCPU_share> \ --daily-maintenance-window <maintenance_window_settings> \ --disk-size <storage_size_in_GB> \ --disk-type <storage_type> \ --fixed-size <fixed_number_of_nodes_per_group> \ --location <location_settings_for_cluster_hosts> \ --memory <amount_of_RAM_in_GB> \ --name <node_group_name> \ --network-acceleration-type <network_acceleration_type> \ --network-interface security-group-ids=[<security_group_IDs>],subnets=[<subnet_names>],ipv4-address=<IP_address_assignment_method> \ --platform-id <platform_ID> \ --container-runtime <container_runtime_environment> \ --preemptible \ --public-ip \ --template-labels <node_group_cloud_labels> \ --version <Kubernetes_version_on_group_nodes> \ --node-name <node_name_template> \ --node-taints <taints>
Where:
-
--allowed-unsafe-sysctls
: Permission for Managed Service for Kubernetes group nodes to use unsafe kernel parameters, comma-separated. -
--cluster-name
: Name of the Managed Service for Kubernetes cluster where the node group is created. -
--cores
: Number of vCPUs for Managed Service for Kubernetes nodes. -
--core-fraction
: Guaranteed share of vCPUs for Managed Service for Kubernetes nodes. -
--daily-maintenance-window
: Maintenance window settings. -
--disk-size
: Disk size of the Managed Service for Kubernetes node. -
--disk-type
: Disk type of the Managed Service for Kubernetes node,network-nvme
ornetwork-hdd
. -
--fixed-size
: Number of nodes in the Managed Service for Kubernetes node group. -
--location
: Availability zone, network, and subnet to host Managed Service for Kubernetes nodes. You can specify several options.If you transmit
--location
,--network-interface
, and--public-ip
in the same command, you will get an error. It is sufficient to specify the location of a Managed Service for Kubernetes node group either in--location
or--network-interface
.To assign public IP addresses to Managed Service for Kubernetes nodes, do one of the following:
- Specify
--network-interface ipv4-address=nat
or--network-interface ipv6-address=nat
. - Enable access to Managed Service for Kubernetes nodes from the internet after creating a node group.
- Specify
-
--memory
: Amount of memory allocated for Managed Service for Kubernetes nodes. -
--name
: Name of the Managed Service for Kubernetes node group. -
--network-acceleration-type
: Type of network acceleration:standard
: No acceleration.software-accelerated
: Software-accelerated network.
Warning
Before activating a software-accelerated network, make sure that you have sufficient cloud resources available to create an additional Managed Service for Kubernetes node.
-
--network-interface
: Network settings:security-group-ids
: IDs of Security groups.subnets
: Names of subnets that will host the nodes.ipv4-address
: Method of assigning an IPv4 address.ipv6-address
: Method of assigning an IPv6 address.
ipv4-address
andipv6-address
determine the method of assigning an IP address:auto
: Only the internal IP address is assigned to the node.nat
: Public and internal IP addresses are assigned to the node.
-
--platform-id
: Platform for Managed Service for Kubernetes nodes. -
--container-runtime
: Container runtime environment,docker
orcontainerd
. -
--preemptible
: Flag specified if the VM instances should be preemptible. -
--public-ip
: Flag you set if the Managed Service for Kubernetes node group needs a public IP address. -
--template-labels
: Node group cloud labels in<label_name>=<label_value>
format. You can specify multiple labels separated by commas. -
--version
: Kubernetes version on Managed Service for Kubernetes group nodes. -
--node-name
: Name template for Managed Service for Kubernetes nodes. The name is unique if the template contains at least one of the following variables:{instance_group.id}
: Instance group ID.{instance.index}
: Unique instance number in the instance group. Possible values: 1 to N, where N is the number of instances in the group.{instance.index_in_zone}
: Instance number in a zone. It's unique for a specific instance group within the zone.{instance.short_id}
: Instance ID that is unique within the group. Consists of four letters.{instance.zone_id}
: Zone ID.
For example,
prod-{instance.short_id}-{instance_group.id}
. If not specified, the default value is used:{instance_group.id}-{instance.short_id}
. -
--node-taints
: Kubernetes taint policies. You can specify multiple policies.
Warning
The
user-data
key is not supported for transmitting user data. Parameters for ssh connections must be specified in thessh-keys
key in the VM metadata.Result:
done (1m17s) id: catpl8c44kii******** cluster_id: catcsqidoos7******** ... start_time: hours: 22 duration: 36000s
-
-
To specify a placement group for Managed Service for Kubernetes nodes:
-
Retrieve a list of placement groups using the
yc compute placement-group list
command. -
Provide a placement group name or ID in the
--placement group
flag when creating a Managed Service for Kubernetes node group:yc managed-kubernetes node-group create \ ... --placement-group <placement_group_name_or_ID>
-
To create a Managed Service for Kubernetes node group:
-
In the folder containing the cluster description file, create a configuration file with the new Managed Service for Kubernetes node group's parameters:
- Managed Service for Kubernetes node group name.
- Managed Service for Kubernetes cluster ID in the
cluster_id
parameter. - Managed Service for Kubernetes node platform.
- Container runtime environment setting in the
container_runtime
parameter. - Node group cloud labels in the
nodeTemplate.labels
section. - Scaling settings in the
scale_policy
parameter.
Here is an example of the configuration file structure:
resource "yandex_kubernetes_node_group" "<node_group_name>" { cluster_id = yandex_kubernetes_cluster.<cluster_name>.id name = "<node_group_name>" ... instance_template { name = "<node_name_template>" platform_id = "<node_platform>" network_acceleration_type = "<network_acceleration_type>" container_runtime { type = "<container_runtime_environment>" } labels { "<label_name>"="<label_value>" } ... } ... scale_policy { <node_group_scaling_settings> } }
Where:
cluster_id
: ID of the Managed Service for Kubernetes cluster.--name
: Name of the Managed Service for Kubernetes node group.instance_template
: Managed Service for Kubernetes node parameters:-
name
: Managed Service for Kubernetes node name template. The name is unique if the template contains at least one of the following variables:{instance_group.id}
: Instance group ID.{instance.index}
: Unique instance number in the instance group. Possible values: 1 to N, where N is the number of instances in the group.{instance.index_in_zone}
: Instance number in a zone. It's unique for a specific instance group within the zone.{instance.short_id}
: Instance ID that is unique within the group. Consists of four letters.{instance.zone_id}
: Zone ID.
For example,
prod-{instance.short_id}-{instance_group.id}
. If not specified, the default value is used:{instance_group.id}-{instance.short_id}
. -
platform_id
: Managed Service for Kubernetes node platform. -
network_acceleration_type
: Network acceleration type:standard
: No acceleration.software-accelerated
: Software-accelerated network.
Warning
Before activating a software-accelerated network, make sure that you have sufficient cloud resources available to create an additional Managed Service for Kubernetes node.
-
container_runtime
:type
: Container runtime environment (docker
orcontainerd
).
-
labels
: Node group cloud labels. You can specify multiple labels separated by commas. -
scale_policy
: Scaling settings.
-
Warning
The Managed Service for Kubernetes node group configuration file must be in the same folder as the cluster description file.
-
To create a node group with a constant number of nodes, add a
fixed_scale
section:resource "yandex_kubernetes_node_group" "<node_group_name>" { ... scale_policy { fixed_scale { size = <number_of_nodes_per_group> } } }
-
To create a Managed Service for Kubernetes node group with autoscaling, add an
auto_scale
section:resource "yandex_kubernetes_node_group" "<node_group_name>" { ... scale_policy { auto_scale { min = <minimum_number_of_nodes_per_group> max = <maximum_number_of_nodes_per_group> initial = <initial_number_of_nodes_per_group> } } }
-
To add DNS records:
-
Add the
instance_template.network_interface.ipv4_dns_records
section:resource "yandex_kubernetes_node_group" "<node_group_name>" { ... instance_template { network_interface { ipv4_dns_records { fqdn = "<DNS_record_FQDN>" dns_zone_id = "<DNS_zone_ID>" ttl = "<DNS_record_TTL_in_seconds>" ptr = "<PTR_record_creation>" } } } }
Where
ptr
denotes a PTR record creation:true
orfalse
.In a DNS record's FQDN, you can use a template with variables:
{instance_group.id}
: Instance group ID.{instance.index}
: Unique instance number in the instance group. Possible values: 1 to N, where N is the number of instances in the group.{instance.index_in_zone}
: Instance number in a zone. It is unique for a specific instance group within a zone.{instance.short_id}
: Instance ID that is unique within the group. It consists of four alphabetic characters.{instance.zone_id}
: Zone ID.
For more information, see the Terraform provider documentation
. -
Make sure the configuration files are valid.
-
In the command line, go to the folder where you created the configuration file.
-
Run the check using the command:
terraform plan
If the configuration is described correctly, the terminal displays a list of created resources and their parameters. If there are errors in the configuration, Terraform points them out. This is a test step. No resources are created.
-
-
Create a Managed Service for Kubernetes cluster.
-
If the configuration doesn't contain any errors, run the command:
terraform apply
-
Confirm that you want to create the resources.
After this, all the necessary resources will be created in the specified folder and the IP addresses of the VMs will be displayed in the terminal. You can check resource availability and their settings in the management console
. -
Use the create API method and include the following information in the request:
-
Managed Service for Kubernetes cluster ID in the
clusterId
parameter. You can get it with a list of Managed Service for Kubernetes clusters in the folder. -
Managed Service for Kubernetes node group configuration as
nodeTemplate
. -
Network acceleration type in the
nodeTemplate.networkSettings.type
parameter.Warning
Before activating a software-accelerated network, make sure that you have sufficient cloud resources available to create an additional Managed Service for Kubernetes node.
-
Container runtime environment in the
nodeTemplate.containerRuntimeSettings.type
parameter. -
Node group cloud labels in the
nodeTemplate.labels
parameter. -
Scaling settings in the
scalePolicy
parameter. -
Managed Service for Kubernetes node group placement settings in the
allocationPolicy
parameters. -
Maintenance window settings in the
maintenancePolicy
parameters. -
List of settings to be changed in the
updateMask
parameter.
Warning
This API method overrides all parameters of the object being modified that were not explicitly passed in the request to the default values. To avoid this, list the settings you want to change in the updateMask
parameter (one line separated by commas).
For nodes to use non-replicated disks, pass the network-ssd-nonreplicated
value for the nodeTemplate.bootDiskSpec.diskTypeId
parameter.
You can only change the size of non-replicated disks in 93 GB increments. The maximum size of this type of disk is 4 TB.
Alert
Non-replicated disks have no redundancy. If a disk fails, its data will be irretrievably lost. For more information, see Non-replicated disks and high-performance SSDs.
To enable Managed Service for Kubernetes group nodes to use unsafe kernel parameters, provide their names in the allowedUnsafeSysctls
parameter.
To set taint policies, provide their values in the nodeTaints
parameter.
To set a template for Managed Service for Kubernetes node names, provide it in the nodeTemplate.name
parameter. The name is unique if the template contains at least one of the following variables:
{instance_group.id}
: Instance group ID.{instance.index}
: Unique instance number in the instance group. Possible values: 1 to N, where N is the number of instances in the group.{instance.index_in_zone}
: Instance number in a zone. It's unique for a specific instance group within the zone.{instance.short_id}
: Instance ID that is unique within the group. Consists of four letters.{instance.zone_id}
: Zone ID.
For example, prod-{instance.short_id}-{instance_group.id}
. If not specified, the default value is used: {instance_group.id}-{instance.short_id}
.
To add DNS records, pass their settings in the nodeTemplate.v4AddressSpec.dnsRecordSpecs
parameter. In a DNS record's FQDN, you can use the nodeTemplate.name
node name template with variables.
Alert
After you create a Managed Service for Kubernetes node group, Yandex Compute Cloud will display one or more VMs with automatically generated names. Do not update the names of the VMs that belong to a Managed Service for Kubernetes cluster. This will disrupt the operation of the node group and the entire Managed Service for Kubernetes cluster.