Creates and manages Elastic Container Instance (ECI)-based scaling groups by using a configuration file. You can call the ApplyScalingGroup operation to implement this feature.
Operation description
Operation description
ApplyScalingGroup supports the quick creation of ECI-based 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 configuration. Within a region, the same YAML configuration can map to only one scaling group. 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.
Precautions
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, you must enable public network access. Set
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 is triggered.
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 implement the multi-zone feature. |
| k8s.aliyun.com/eci-security-group | sg-bp1dktddjsg5nktv**** | The security group ID. Requirements: You can specify one or more security groups, up to a maximum of five. The specified security groups must belong to the same VPC. The specified security groups must be of the same type. |
| k8s.aliyun.com/eci-sls-enable | "false" | Set this parameter to false to disable the log collection feature. When you collect logs by using SLS CRDs, if certain pods do not require log collection, configure this annotation to disable the log collection feature and avoid resource waste caused by automatic creation of Logtail. |
| k8s.aliyun.com/eci-spot-strategy | SpotAsPriceGo | The bidding policy for spot instances. Configure as needed. SpotWithPriceLimit: Set 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. The value can be accurate to three decimal places. This parameter takes effect only when k8s.aliyun.com/eci-spot-strategy is set to SpotWithPriceLimit. |
| k8s.aliyun.com/eci-with-eip | "true" | Set this parameter to true to automatically create and attach an EIP. |
| k8s.aliyun.com/eci-data-cache-bucket | default | The DataCache bucket. This parameter is required when you use DataCache to create a pod. |
| k8s.aliyun.com/eci-data-cache-pl | PL1 | The performance level (PL) of the cloud disk created based on DataCache. ESSD 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}, where 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 (performance 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 tag string to attach. You can attach up to three tags. Separate tag keys and tag values with colons (:), and separate multiple tags 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 |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token 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.