All Products
Search
Document Center

:Modify the configuration of a node pool

更新时间:Nov 17, 2023

You can call the ModifyClusterNodePool operation to modify the configuration of a node pool.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request header

This operation uses only common request headers. For more information, see Common request parameters.

Request syntax

PUT /clusters/{ClusterId}/nodepools/{NodepoolId} HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

ClusterId

String

Path

Yes

c23421cfa74454bc8b37163fd19af****

The cluster ID.

NodepoolId

String

Path

Yes

p31da1b38983f4511b490fc62108a****

The ID of the node pool.

Object

Body

No

The request parameters.

auto_scaling

Object

Body

No

The configurations about auto scaling.

eip_bandwidth

Long

Body

No

5

The maximum bandwidth of the elastic IP address (EIP) that is associated with the node pool.

eip_internet_charge_type

String

Body

No

PayByBandwidth

The billing method of the EIP. Valid values:

  • PayByBandwidth: pay-by-bandwidth.

  • PayByTraffic: pay-by-data-transfer.

Default value: PayByBandwidth.

enable

Boolean

Body

No

true

Specifies whether to enable auto scaling.

  • true: enables auto scaling for the node pool.

  • false: disables auto scaling for the node pool. If you set this parameter to false, other parameters in the auto_scaling section do not take effect.

Default value: false.

is_bond_eip

Boolean

Body

No

true

Specifies whether to associate an EIP with a node pool. Valid values:

  • true: associates an EIP with the node pool.

  • false: does not associate an EIP with the node pool.

Default value: false.

max_instances

Long

Body

No

10

The maximum number of Elastic Compute Service (ECS) instances that can be created in the node pool.

min_instances

Long

Body

No

2

The minimum number of ECS instances that must be kept in the node pool.

type

String

Body

No

cpu

The instance types that can be used for the auto scaling of a node pool. Valid values:

  • cpu: regular instance.

  • gpu: GPU-accelerated instance.

  • gpushare: shared GPU-accelerated instance.

  • spot: preemptible instance

Default value: cpu.

kubernetes_config

Object

Body

No

The configuration about the cluster.

cms_enabled

Boolean

Body

No

true

Specifies whether to install the CloudMonitor agent on ECS nodes. After the CloudMonitor agent is installed on ECS nodes, you can view monitoring information about the instances in the CloudMonitor console. We recommend that you install the CloudMonitor agent. Valid values:

  • true: installs the CloudMonitor agent on ECS nodes.

  • false: does not install the CloudMonitor agent on ECS nodes.

Default value: false.

cpu_policy

String

Body

No

none

The CPU management policy of the nodes in a node pool. The following policies are supported if the Kubernetes version of the cluster is 1.12.6 or later.

  • static: allows pods with specific resource characteristics on the node to be granted enhanced CPU affinity and exclusivity.

  • none: specifies that the default CPU affinity is used.

Default value: none

labels

Array of tag

Body

No

The labels of the nodes in the node pool. You can add labels to the nodes in the cluster. You must add labels based on the following rules:

  • Each label is a case-sensitive key-value pair. You can add at most 20 labels.

  • The key must be unique and cannot exceed 64 characters in length. The value can be empty and cannot exceed 128 characters in length. Keys and values cannot start with aliyun, acs:, https://, or http://. For more information, see Labels and Selectors.

runtime

String

Body

No

docker

The name of the container runtime.

runtime_version

String

Body

No

19.03.5

The version of the container runtime.

taints

Array of taint

Body

No

The configurations of node taints.

user_data

String

Body

No

IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi

The user-defined data of the node pool. For more information, see Prepare user data.

nodepool_info

Object

Body

No

The configurations of the node pool.

name

String

Body

No

default-nodepool

The name of the node pool.

The name must be 1 to 63 characters in length, and can contain digits, letters, and hyphens (-). It cannot start with a hyphen (-).

resource_group_id

String

Body

No

rg-acfmyvw3wjm****

The ID of the resource group to which the node pool belongs.

scaling_group

Object

Body

No

The configurations of the scaling group.

data_disks

Array of data_disk

Body

No

The configurations of the data disks that are mounted to the nodes in the node pool. You can mount 0 to 10 data disks. You can mount at most 10 data disks to the nodes in the node pool.

instance_charge_type

String

Body

No

PostPaid

The billing method of the nodes in a node pool. Valid values:

  • PrePaid: subscription.

  • PostPaid: pay-as-you-go

Default value: PostPaid.

period

Long

Body

No

1

The subscription duration of the nodes in the node pool. This parameter takes effect and is required only when you set instance_charge_type to PrePaid.

If you specify PeriodUnit=Month, the valid values are 1, 2, 3, 6, 12, 24, 36, 48, and 60.

period_unit

String

Body

No

Month

The billing cycle of the nodes. This parameter is required if instance_charge_type is set to PrePaid.

The billing cycle is measured only in months.

Default value: Month.

auto_renew

Boolean

Body

No

true

Specifies whether to enable auto-renewal for the nodes in the node pool. This parameter takes effect only when you set instance_charge_type to PrePaid. Valid values:

  • true: enables auto-renewal.

  • false: disables auto-renewal.

Default value: true.

auto_renew_period

Long

Body

No

1

The duration of the auto-renewal. This parameter takes effect and is required only when you set instance_charge_type to PrePaid.

If you specify PeriodUnit=Month, the valid values are 1, 2, 3, 6, and 12.

platform

String

Body

No

AliyunLinux

The OS platform. Valid values:

  • AliyunLinux

  • CentOS

  • Windows

  • WindowsCore

image_id

String

Body

No

aliyun_2_1903_x64_20G_alibase_20200904.vhd

The ID of the custom image. You can call the DescribeKubernetesVersionMetadata operation to query the supported images. By default, the latest image is used.

spot_strategy

String

Body

No

SpotWithPriceLimit

The bidding policy of preemptible instances. Valid values:

  • NoSpot: non-preemptible instance.

  • SpotWithPriceLimit: specifies the highest bid for the preemptible instance.

  • SpotAsPriceGo: automatically submits bids based on the up-to-date market price.

For more information, see Preemptible instances.

spot_price_limit

Array

Body

No

The bid configurations of preemptible instances.

instance_type

String

Body

No

ecs.c6.large

The instance type of preemptible instances.

price_limit

String

Body

No

0.39

The maximum bid price of a preemptible instance.

Unit: USD/hour.

instance_types

Array of String

Body

No

ecs.c6.large

The instance type. For more information, see Instance categories.

key_pair

String

Body

No

pro-nodepool

The name of the key pair. You must set this parameter or the login_password parameter. You must set key_pair if the node pool is a managed node pool.

login_password

String

Body

No

Hello1234

The password for SSH logon. You must set this parameter or the key_pair parameter. The password must be 8 to 30 characters in length, and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

rds_instances

Array of String

Body

No

rds-xxx

The IDs of ApsaraDB RDS instances. After you specify the list of RDS instances, the ECS instances in the cluster are automatically added to the whitelist of the RDS instances.

scaling_policy

String

Body

No

release

The scaling mode of the scaling group. Valid values:

  • release: the standard mode. ECS instances are created and released based on the resource usage.

  • recycle: the swift mode. ECS instances are created, stopped, or started during scaling events. This reduces the time required for the next scale-out event. When the instance is stopped, you are charged only for the storage service. This does not apply to ECS instances that are attached with local disks.

system_disk_category

String

Body

No

cloud_efficiency

The type of system disk. Valid values:

  • cloud_efficiency: ultra disk

  • cloud_ssd: standard SSD

Default value: cloud_ssd.

system_disk_size

Long

Body

No

120

The system disk size of a node. Unit: GiB.

Valid values: 20 to 500.

The value of this parameter must be at least 20 and greater than or equal to the size of the specified image.

The default value is the greater one between 40 and the image size.

system_disk_performance_level

String

Body

No

PL1

The performance level (PL) of the system disk that you want to use for the node. This parameter takes effect only for enhanced SSDs (ESSDs). You can specify a higher PL if you increase the size of the system disk. For more information, see Enhanced SSDs.

tags

Array of tag

Body

No

The labels that you want to add to the ECS instances.

A key must be unique and cannot exceed 128 characters in length. Neither keys nor values can start with aliyun or acs:. Neither keys nor values can contain https:// or http://.

vswitch_ids

Array of String

Body

No

vsw-wz9uwxhawmtzg7u9h****

The IDs of vSwitches.

multi_az_policy

String

Body

No

BALANCE

The ECS instance scaling policy for a multi-zone scaling group. Valid values:

  • PRIORITY: the scaling group is scaled based on the VSwitchIds.N parameter. If an ECS instance cannot be created in the zone where the vSwitch that has the highest priority resides, Auto Scaling creates the ECS instance in the zone where the vSwitch that has the next highest priority resides.

  • COST_OPTIMIZED: ECS instances are created based on the vCPU unit price in ascending order. Preemptible instances are preferably created when preemptible instance types are specified in the scaling configuration. You can set the CompensateWithOnDemand parameter to specify whether to automatically create pay-as-you-go instances when preemptible instances cannot be created due to insufficient resources.

    Note

    COST_OPTIMIZED is valid only when multiple instance types are specified or at least one preemptible instance type is specified.

  • BALANCE: ECS instances are evenly distributed across multiple zones specified by the scaling group. If ECS instances become imbalanced among multiple zones due to insufficient inventory, you can call the RebalanceInstances operation of Auto Scaling to balance the instance distribution among zones. For more information, see RebalanceInstances.

Default value: PRIORITY.

on_demand_base_capacity

Long

Body

No

0

The minimum number of pay-as-you-go instances that must be kept in the scaling group. Valid values: 0 to 1000. If the number of pay-as-you-go instances is less than the value of this parameter, Auto Scaling preferably creates pay-as-you-go instances.

on_demand_percentage_above_base_capacity

Long

Body

No

20

The percentage of pay-as-you-go instances among the extra instances that exceed the number specified by on_demand_base_capacity. Valid values: 0 to 100.

spot_instance_pools

Long

Body

No

5

The number of instance types that are available. Auto Scaling creates preemptible instances of multiple instance types that are available at the lowest cost. Valid values: 1 to 10.

spot_instance_remedy

Boolean

Body

No

false

Specifies whether to supplement preemptible instances when the number of preemptible instances drops below the specified minimum number. If this parameter is set to true, when the scaling group receives a system message that a preemptible instance is to be reclaimed, the scaling group attempts to create a new instance to replace this instance. Valid values:

  • true: enables the supplementation of preemptible instances.

  • false: disables the supplementation of preemptible instances.

compensate_with_on_demand

Boolean

Body

No

true

Specifies whether to automatically create pay-as-you-go instances to meet the required number of ECS instances if preemptible instances cannot be created due to reasons such as the cost or insufficient inventory. This parameter takes effect only when multi_az_policy is set to COST_OPTIMIZED. Valid values:

  • true: automatically creates pay-as-you-go instances to meet the required number of ECS instances if preemptible instances cannot be created.

  • false: does not create pay-as-you-go instances to meet the required number of ECS instances if preemptible instances cannot be created

internet_charge_type

String

Body

No

PayByBandwidth

The metering method of the public IP address. Valid values:

  • PayByBandwidth: pay-by-bandwidth.

  • PayByTraffic: pay-by-data-transfer.

internet_max_bandwidth_out

Long

Body

No

5

The maximum outbound bandwidth of the public IP address of the node. Unit: Mbit/s. Valid values: 1 to 100.

desired_size

Long

Body

No

2

The expected number of nodes in the node pool.

private_pool_options

Object

Body

No

The configurations of the private node pool.

id

String

Body

No

eap-bp67acfmxazb4****

The ID of the private node pool.

match_criteria

String

Body

No

Open

The type of private node pool. This parameter specifies the type of the private pool that you want to use to create instances. A private node pool is generated when an elasticity assurance or a capacity reservation service takes effect. The system selects a private node pool to launch instances. Valid values:

  • Open: open private node pool. The system selects an open private node pool to launch instances. If no matching open private node pool is available, the resources in the public node pool are used.

  • Target: specific private pool. The system uses the resources of the specified private node pool to launch instances. If the specified private node pool is unavailable, instances cannot be started.

  • None: no private node pool is used. The resources of private node pools are not used to launch the instances.

tee_config

Object

Body

No

The configurations about confidential computing for the cluster.

tee_enable

Boolean

Body

No

false

Specifies whether to enable confidential computing for the cluster. Valid values:

  • true: enables confidential computing for the cluster.

  • false: disables confidential computing for the cluster.

Default value: false.

management

Object

Body

No

The configurations about the managed node pool feature.

enable

Boolean

Body

No

true

Specifies whether to enable the managed node pool feature. Valid values:

  • true: enables the managed node pool feature.

  • false: disables the managed node pool feature. Other parameters in this section take effect only when enable=true is specified.

Default value: false.

auto_repair

Boolean

Body

No

true

Specifies whether to enable auto repair. This parameter takes effect only when you specify enable=true. Valid values:

  • true: enables auto repair

  • false: disables auto repair.

Default value: true.

upgrade_config

Object

Body

No

The configurations about auto update. The configurations take effect only when you specify enable=true.

auto_upgrade

Boolean

Body

No

true

Specifies whether to enable auto update. Valid values:

  • true: enables auto update.

  • false: disables auto update.

Default value: true.

surge

Long

Body

No

5

The number of nodes that are temporarily added to the node pool during an auto upgrade. Additional nodes are used to host the workloads of nodes that are being upgraded.

Note

We recommend that you specify the number of additional nodes to a value smaller than the number of existing nodes in the node pool.

surge_percentage

Long

Body

No

0

The percentage of temporary nodes to the nodes in the node pool. You must set this parameter or surge.

max_unavailable

Long

Body

No

1

The maximum number of nodes that can be in the Unschedulable state.

Valid values: 1 to 1000.

Default value: 1.

auto_repair_policy

Object

Body

No

The auto node repair policy.

restart_node

Boolean

Body

No

true

Specifies whether ACK is allowed to automatically restart nodes after repairing the nodes. Valid values:

  • true: yes

  • false: no

auto_vul_fix

Boolean

Body

No

true

Specifies whether ACK is allowed to automatically patch CVE vulnerabilities. Valid values:

  • true: yes

  • false: no

auto_vul_fix_policy

Object

Body

No

The auto CVE patching policy.

restart_node

Boolean

Body

No

true

Specifies whether ACK is allowed to automatically restart nodes after patching CVE vulnerabilities. Valid values:

  • true: yes

  • false: no

vul_level

String

Body

No

asap,nntf

The severity levels of vulnerabilities that ACK is allowed to automatically patch. Multiple severity levels are separated by commas (,).

auto_upgrade

Boolean

Body

No

true

Specifies whether to enable auto update. Valid values:

  • true: enables auto update.

  • false: disables auto update.

auto_upgrade_policy

Object

Body

No

The auto update policy.

auto_upgrade_kubelet

Boolean

Body

No

true

Specifies whether ACK is allowed to automatically update the kubelet. Valid values:

  • true: yes

  • false: no

update_nodes

Boolean

Body

No

true

Specifies whether to update node information, such as labels and taints.

Response parameters

Parameter

Type

Example

Description

task_id

String

T-5fd211e924e1d00787000293

The task ID.

nodepool_id

String

np737c3ac1ac684703b9e10673aa2c****

The node pool ID.

Examples

Sample requests

PUT /clusters/c23421cfa74454bc8b37163fd19af****/nodepools/p31da1b38983f4511b490fc62108a**** HTTP/1.1
Host:cs.aliyuncs.com
Content-Type:application/json

{
  "auto_scaling" : {
    "eip_bandwidth" : 5,
    "eip_internet_charge_type" : "PayByBandwidth",
    "enable" : true,
    "is_bond_eip" : true,
    "max_instances" : 10,
    "min_instances" : 2,
    "type" : "cpu"
  },
  "kubernetes_config" : {
    "cms_enabled" : true,
    "cpu_policy" : "none",
    "labels" : [ {
      "key" : "env",
      "value" : "prod"
    } ],
    "runtime" : "docker",
    "runtime_version" : "19.03.5",
    "taints" : [ {
      "key" : "key",
      "value" : "value",
      "effect" : "NoSchedule"
    } ],
    "user_data" : "IyEvdXNyL2Jpbi9iYXNoCmVjaG8gIkhlbGxvIEFDSyEi"
  },
  "nodepool_info" : {
    "name" : "default-nodepool",
    "resource_group_id" : "rg-acfmyvw3wjm****"
  },
  "scaling_group" : {
    "data_disks" : [ {
      "category" : "cloud_ssd",
      "size" : 40,
      "encrypted" : "true",
      "auto_snapshot_policy_id" : "sp-2zej1nogjvovnz4z****",
      "performance_level" : "PL1"
    } ],
    "instance_charge_type" : "PostPaid",
    "period" : 1,
    "period_unit" : "Month",
    "auto_renew" : true,
    "auto_renew_period" : 1,
    "platform" : "AliyunLinux",
    "image_id" : "aliyun_2_1903_x64_20G_alibase_20200904.vhd",
    "spot_strategy" : "SpotWithPriceLimit",
    "spot_price_limit" : [ {
      "instance_type" : "ecs.c6.large",
      "price_limit" : "0.39"
    } ],
    "instance_types" : [ "ecs.c6.large" ],
    "key_pair" : "pro-nodepool",
    "login_password" : "Hello1234",
    "rds_instances" : [ "rds-xxx" ],
    "scaling_policy" : "release",
    "system_disk_category" : "cloud_efficiency",
    "system_disk_size" : 120,
    "system_disk_performance_level" : "PL1",
    "tags" : [ {
      "key" : "env",
      "value" : "prod"
    } ],
    "vswitch_ids" : [ "vsw-wz9uwxhawmtzg7u9h****" ],
    "multi_az_policy" : "BALANCE",
    "on_demand_base_capacity" : 0,
    "on_demand_percentage_above_base_capacity" : 20,
    "spot_instance_pools" : 5,
    "spot_instance_remedy" : false,
    "compensate_with_on_demand" : true,
    "internet_charge_type" : "PayByBandwidth",
    "internet_max_bandwidth_out" : 5,
    "desired_size" : 2,
    "private_pool_options" : {
      "id" : "eap-bp67acfmxazb4****",
      "match_criteria" : "Open"
    }
  },
  "tee_config" : {
    "tee_enable" : false
  },
  "management" : {
    "enable" : true,
    "auto_repair" : true,
    "upgrade_config" : {
      "auto_upgrade" : true,
      "surge" : 5,
      "surge_percentage" : 0,
      "max_unavailable" : 1
    }
  },
  "update_nodes" : true
}

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyClusterNodePoolResponse>
    <task_id>T-5fd211e924e1d00787000293</task_id>
    <nodepool_id>np737c3ac1ac684703b9e10673aa2c****</nodepool_id>
</ModifyClusterNodePoolResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "task_id" : "T-5fd211e924e1d00787000293",
  "nodepool_id" : "np737c3ac1ac684703b9e10673aa2c****"
}

Error codes

For a list of error codes, see Service error codes.