If you create an Elastic Container Instance pod by specifying the number of vCPUs and memory size, you may require specific Elastic Compute Service (ECS) instance types. For example, you want to use only the ecs.g6 instance family to create the pod. In this case, you can add the k8s.aliyun.com/eci-instance-family
annotation to specify the desired ECS instance family. This topic describes how to specify or exclude specific ECS instance families when you create an Elastic Container Instance pod.
Feature description
When you create a pod by specifying the number of vCPUs and memory size, the system uses multiple ECS instance types to support the creation. The system automatically selects ECS instance types that meet the vCPU and memory specification requirements and have sufficient resources. In this case, you can add the k8s.aliyun.com/eci-instance-family
annotation to specify or exclude specific ECS instance families.
If you specify specific ECS instance families, the system selects ECS instance types only from the specified ECS instance families. If the resources of the specified ECS instance families are insufficient, the system does not create a pod.
If you exclude specific ECS instance families, the system selects instance types from other ECS instance families that are supported by Elastic Container Instance to create a pod.
You can use the k8s.aliyun.com/eci-instance-family annotation together with the k8s.aliyun.com/eci-instance-generation
annotation to implement finer-grained control on ECS instance types. k8s.aliyun.com/eci-instance-generation specifies or excludes specific generations of ECS instance families.
The following table describes the ECS instance families that you can specify or exclude:
Generation of ECS instance families | ECS instance families |
8 | g8i, c8i, r8i, hfg8i, hfc8i, and hfr8i |
7 | g7, c7, r7, hfg7, hfc7, hfr7, and g7ne |
6 | g6e, g6, c6e, c6, r6e, r6, hfc6, and hfg6 |
5 | u1, g5, g5ne, c5, r5, ic5, hfc5, and hfg5 |
4 | sn2ne, sn1ne, se1ne, and se1 |
For more information about ECS instance families, see the following topics:
Precautions
Pods are billed based on the actual ECS instance type used, rather than the specified vCPU and memory specifications, when created based on specified or excluded ECS instance families.
ImportantAfter a pod is created, you can run the
kubectl describe pod
command to view the YAML details of the pod. The value of thek8s.aliyun.com/eci-instance-spec
field indicates the ECS instance type that is used by the pod. The pod is billed based on the ECS instance type.When you specify or exclude specific ECS instance families, the system cannot automatically select specific instance types. For example, the system cannot automatically select GPU-accelerated instance types, such as the instance types of the gn6i instance family, and instance types equipped with local disks, such as instance types of the i2g instance family. If you want to use specific ECS instance types, create pods by specifying ECS instance types. For more information, see Specify ECS instance types to create a pod.
The feature of specifying or excluding specific ECS instance families takes effect only if you create pods by specifying the number of vCPUs and memory size. If you create pods by specifying ECS instance types, the feature does not take effect.
When you create a preemptible elastic container instance, the system selects the most appropriate ECS instance type based on the specified or excluded instance families. The selection is determined by the sorting order of the instance families and the market price of the instance types, with the market price taking precedence over the sorting order. If you have strict requirements for ECS instance families, we recommend that you configure only one instance family.
Configuration description
Valid values of k8s.aliyun.com/eci-instance-family
are ECS instance families. Take note of the following items:
You can configure multiple instance families. Valid values: ECS instance families that are supported by Elastic Container Instance.
If you add a minus sign (
-
) before an instance family, the instance family is excluded when you create a pod.For example,
k8s.aliyun.com/eci-instance-family: "-ecs.c6, -ecs.c5"
specifies that the ecs.c6 and ecs.c5 instance families are excluded.The system selects the specified instance families based on their sorting order.
For example, the
k8s.aliyun.com/eci-instance-family: "ecs.c6, ecs.c5"
annotation specifies that the system preferentially uses the ecs.c6 instance family. If the resources of the ecs.c6 instance family that meet the vCPU and memory specification requirements are insufficient, the ecs.c5 instance family is used. If the resources of the ecs.c5 instance family are also insufficient, no pod is created.
Before you use the k8s.aliyun.com/eci-instance-family
annotation, you must specify the vCPU and memory specifications by using one of the following methods:
Configure the limits or requests parameter of containers. We recommend that you configure the limits parameter.
Add the
k8s.aliyun.com/eci-use-specs
annotation to the metadata of the pod.