ApplyScalingGroup
Creates and manages ECI-based scaling groups by using a configuration file. You can call the ApplyScalingGroup operation to implement this feature.
Operation description
Operation description
ApplyScalingGroup allows you to quickly create ECI scaling groups in the Kubernetes Deployment resource definition format. ECI instances also support Kubernetes YAML extended annotations. For more information, see the "Supported annotations" section of this topic.
Mapping between YAML configurations and scaling groups: A scaling group name is mapped by the namespace, kind, and name triplet defined in the YAML. Within a region, a YAML configuration can map to only one scaling group. For example:
If you use a Deployment YAML configuration with name set to nginx under the default namespace, it maps to a scaling group named k8s_default_Deployment_nginx in the same region.
Logic for managing scaling groups based on YAML configurations:
If the scaling group mapped by the YAML configuration exists, the scaling group is updated based on the YAML configuration.
If the scaling group mapped by the YAML configuration does not exist, a scaling group is created based on the YAML configuration.
Before you begin
If the YAML configuration does not specify VPC, vSwitch, or security group annotations, the system performs automatic creation of a default VPC, a default vSwitch within the VPC, and a default Auto Scaling security group (
ess-default-sg). The security group policy opens TCP ports 22 and 3389 and the ICMP (IPv4) protocol by default. If you require other port protocols, adjust the security group policy accordingly.When using a public image, enable public network access. Settings the
k8s.aliyun.com/eci-with-eip pod annotationto enable the EIP feature.After ApplyScalingGroup applies the YAML configuration, the scaling group and scaling configuration take effect immediately. If replicas is set to a value greater than 0, automatic creation of resources occurs.
Supported annotations
For more information about annotations, see ECI Pod Annotation.
| Parameter | Example | Description |
| k8s.aliyun.com/ess-scaling-group-min-size | 1 | The minimum number of instances in the scaling group. Default value: 0. |
| k8s.aliyun.com/ess-scaling-group-max-size | 20 | The maximum number of instances in the scaling group. Default value: max(replicas, 30). |
| k8s.aliyun.com/eci-ntp-server | 100.100.. | The NTP server. |
| k8s.aliyun.com/eci-use-specs | 2-4Gi | The specification of 2 vCPUs and 4 GiB of memory. For more information, see Create a pod with multiple specifications. |
| k8s.aliyun.com/eci-vswitch | vsw-bp1xpiowfm5vo8o3c**** | The vSwitch ID. You can specify multiple vSwitches to enable the multi-zone feature. |
| k8s.aliyun.com/eci-security-group | sg-bp1dktddjsg5nktv**** | The security group ID. You can specify one or more security groups, up to a maximum of five. The specified security groups must belong to the same VPC and must be of the same type. |
| k8s.aliyun.com/eci-sls-enable | "false" | Settings this parameter to false to shutdown log collection. When you collect logs by using SLS CRDs, if specific pods do not require log collection, configure this annotation to shutdown log collection and avoid unnecessary resource consumption caused by automatic creation of Logtail. |
| k8s.aliyun.com/eci-spot-strategy | SpotAsPriceGo | The bidding policy for spot instances. Configure as needed. SpotWithPriceLimit: settings a custom price limit for spot instances. You must also set k8s.aliyun.com/eci-spot-price-limit. SpotAsPriceGo: the system automatically bids based on the current marketplace price. |
| k8s.aliyun.com/eci-spot-price-limit | "0.5" | The maximum hourly price for spot instances, accurate to three decimal places. This parameter is active only when k8s.aliyun.com/eci-spot-strategy is set to SpotWithPriceLimit. |
| k8s.aliyun.com/eci-with-eip | "true" | Settings this parameter to true for automatic creation and attach of an EIP. |
| k8s.aliyun.com/eci-data-cache-bucket | default | The DataCache bucket. This parameter is required when you create a pod by using DataCache. |
| k8s.aliyun.com/eci-data-cache-pl | PL1 | The performance level (PL) of the cloud disk created based on DataCache. Standard SSD is used by default, and the default PL is PL1. |
| k8s.aliyun.com/eci-data-cache-provisionedIops | "40000" | The provisioned read/write IOPS of the ESSD AutoPL cloud disk. Valid values: 0 to min{50000, 1000 × capacity - baseline performance}. Baseline performance = min{1800 + 50 × capacity, 50000}. For more information, see ESSD AutoPL cloud disk. If this annotation is added, the cloud disk created based on DataCache is an ESSD AutoPL cloud disk. |
| k8s.aliyun.com/eci-data-cache-burstingEnabled | "true" | Specifies whether to enable burst (I/O burst) for the ESSD AutoPL cloud disk. For more information, see ESSD AutoPL cloud disk. If this annotation is added, the cloud disk created based on DataCache is an ESSD AutoPL cloud disk. |
| k8s.aliyun.com/eci-custom-tags | "env:test,name:alice" | The label (Tag) character string to attach. You can attach up to three labels. Separate label keys and label values with colons (:), and separate multiple labels with commas (,). |
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ess:ApplyScalingGroup |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
Ensures the idempotence of the request. Generate a value from your client that is unique across different requests. The value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-42665544**** |
| Content |
string |
Yes |
The content of the configuration file. |
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx annotations: k8s.aliyun.com/eip-bandwidth: 10 k8s.aliyun.com/eci-with-eip: true spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 |
| RegionId |
string |
No |
The region ID. |
cn-hangzhou |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The request ID. |
CC107349-57B7-4405-B1BF-9BF5AF7F**** |
| ScalingGroupId |
string |
The ID of the scaling group that takes effect. |
asg-bp1igpak5ft1flyp**** |
Examples
Success response
JSON format
{
"RequestId": "CC107349-57B7-4405-B1BF-9BF5AF7F****",
"ScalingGroupId": "asg-bp1igpak5ft1flyp****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.