Skip to main content
selectel_mks_nodegroup_v1
Last update:

selectel_mks_nodegroup_v1

For your information

Эта инструкция — копия документации Selectel Terraform-провайдера в Terraform Registry.

Creates and manages a Managed Kubernetes node group using public API v1. For more information about node groups, see the official Selectel documentation.

Example usage

resource "selectel_mks_nodegroup_v1" "nodegroup_1" {
cluster_id = selectel_mks_cluster_v1.cluster_1.id
project_id = selectel_mks_cluster_v1.cluster_1.project_id
region = selectel_mks_cluster_v1.cluster_1.region
availability_zone = "ru-3a"
nodes_count = 3
cpus = 2
ram_mb = 2048
volume_gb = 20
volume_type = "fast.ru-3a"
labels = {
"label-key0": "label-value0",
"label-key1": "label-value1",
"label-key2": "label-value2",
}
taints {
key = "test-key-0"
value = "test-value-0"
effect = "NoSchedule"
}
taints {
key = "test-key-1"
value = "test-value-1"
effect = "NoExecute"
}
taints {
key = "test-key-2"
value = "test-value-2"
effect = "PreferNoSchedule"
}
}

Argument Reference

  • cluster_id - (Required) Unique identifier of the associated Managed Kubernetes cluster. Changing this creates a new node group. Retrieved from the selectel_mks_cluster_v1 resource.

  • project_id - (Required) Unique identifier of the associated project. Changing this creates a new node group. Retrieved from the selectel_vpc_project_v2 resource. Learn more about Projects.

  • region - (Required) Pool where the cluster is located, for example, ru-3. Changing this creates a new node group. Learn more about available pools in the Availability matrix.

  • availability_zone - (Required) Pool segment where all nodes of the node group are located. Changing this creates a new node group. Learn more about available pool segments in the Availability matrix.

  • nodes_count - (Required) Number of worker nodes in the node group. Changing this resizes the node group if enable_autoscale is false.

  • install_nvidia_device_plugin - (Required) Enables or disables installation of the NVIDIA Device Plugin and GPU drivers.
    Boolean flag:

    • true — for flavors with GPU enables installation of the NVIDIA Device Plugin and GPU drivers.
    • false — for flavors without GPU and flavors with GPU disables installation of the NVIDIA Device Plugin and GPU drivers. Learn more about manual installation of GPU drivers.
  • cpus - (Optional) Number of vCPUs for each node. Can be skipped only when flavor_id is set. Changing this creates a new node group. Learn more about Configurations.

  • ram_mb - (Optional) Amount of RAM in MB for each node. Can be skipped only when flavor_id is set. Changing this creates a new node group. Learn more about Configurations.

  • volume_gb - (Optional) Volume size in GB for each node. Can be skipped only when flavor_id is set and local_volume is true. Changing this creates a new node group. Learn more about Configurations.

  • volume_type - (Optional) Type of an OpenStack Block Storage volume for each node. Can be skipped only when flavor_id is set and the flavor properties contain additional specifications for a local volume. Changing this creates a new node group. Available volume types are fast, basic, and universal. The format is <volume_type>.<availability_zone>. Learn more about Network volumes.

  • local_volume - (Optional) Specifies if nodes use a local volume. Cannot be used with the flavors that have specifications for a local volume. Changing this creates a new node group. Boolean flag, the default value is false.

  • flavor_id - (Optional) Unique identifier of an OpenStack flavor for all nodes in the node group. Changing this creates a new node group. Learn more about Flavors.

  • labels - (Optional) List of Kubernetes labels applied to each node in the node group.

  • taints - (Optional) List of Kubernetes taints applied to each node in the node group. Contains a key-value pair and an effect applied for the taint. Available effects are NoSchedule, PreferNoSchedule, and NoExecute. Learn more about Taints.

  • keypair_name - (Optional) Name of the SSH key added to all nodes. Changing this creates a new node group.

  • user_data - (Optional) Base64-encoded script that worker nodes run on the first boot. Changing this creates a new node group. Learn more about User data.

  • affinity_policy - (Optional) Specifies affinity policy of the nodes. Changing this creates a new node group. Available values are soft-anti-affinity and soft-affinity. The default value is soft-anti-affinity. For more information about affinity and anti-affinity, see the official Kubernetes documentation.

  • enable_autoscale - (Optional) Enables or disables autoscaling of the node group. Boolean flag, the default value is false. autoscale_min_nodes and autoscale_max_nodes must be specified. Learn more about Autoscaling.

    • autoscale_min_nodes - (Optional) Minimum number of worker nodes in the node group.

    • autoscale_max_nodes - (Optional) Maximum number of worker nodes in the node group.

Attributes Reference

  • nodes - List of nodes in the node group.

  • nodegroup_type - Type of the node group. Available values are STANDARD, GPU, and SGX.

Import

You can import a node group:

export OS_DOMAIN_NAME=<account_id>
export OS_USERNAME=<username>
export OS_PASSWORD=<password>
export SEL_PROJECT_ID=<selectel_project_id>
export SEL_REGION=<selectel_pool>
terraform import selectel_mks_nodegroup_v1.nodegroup_1 <cluster_id>/<nodegroup_id>

where:

  • <account_id> — Selectel account ID. The account ID is in the top right corner of the Control panel. Learn more about Registration.

  • <username> — Name of the service user. To get the name, in the Control panel, go to Identity & Access ManagementUser management ⟶ the Service users tab ⟶ copy the name of the required user. Learn more about Service users.

  • <password> — Password of the service user.

  • <selectel_project_id> — Unique identifier of the associated project. To get the ID, in the Control panel, go to Cloud Platform ⟶ project name ⟶ copy the ID of the required project. Learn more about Projects.

  • <selectel_pool> — Pool where the cluster is located, for example, ru-3. To get information about the pool, in the Control panel, go to Cloud PlatformKubernetes. The pool is in the Pool column.

  • <cluster_id> — Unique identifier of the cluster, for example, b311ce58-2658-46b5-b733-7a0f418703f2. To get the cluster ID, in the Control panel, go to Cloud PlatformKubernetes ⟶ the cluster page ⟶ copy the ID at the top of the page under the cluster name, near the region and pool.

  • <nodegroup_id> — Unique identifier of the node group, for example, 63ed5342-b22c-4c7a-9d41-c1fe4a142c13. To get the node group ID, in the Control panel, go to Cloud PlatformKubernetes. Click the required cluster. The node group ID is at the top of the node group card, near the pool.