When you create an ECI pod by specifying vCPU and memory, you can add the k8s.aliyun.com/eci-instance-family annotation if you require a specific underlying instance, for example, to use only the ecs.g6 instance family. This topic describes how to specify or exclude ECS instance families when you create an ECI pod.
How it works
When you create an ECI pod by specifying vCPU and memory, the system may use various ECS instance types. It automatically selects an instance type that meets your vCPU and memory requirements and has available inventory. You can add the k8s.aliyun.com/eci-instance-family annotation to narrow the selection by specifying or excluding ECS instance families.
-
If you specify one or more ECS instance families, the system selects instance types only from those families. If no matching instance types in your specified families are available, the pod creation fails.
-
If you exclude one or more ECS instance families, the system selects an instance type from any other supported ECS instance family.
For more granular control, you can combine this annotation with k8s.aliyun.com/eci-instance-generation to specify or exclude ECS instance generations.
The following table lists the ECS instance families that you can specify or exclude.
Architecture | Generation of ECS instance families | ECS instance family |
Arm | 8 | g8y, c8y, and r8y |
|
x86 |
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, hfg6 |
|
5 | u1, g5, g5ne, c5, r5, ic5, hfc5, and hfg5 | |
4 | sn2ne, sn1ne, se1ne, and se1 |
For more information about ECS instance types, see the following topics:
Usage notes
-
ECI pods created by specifying or excluding an ECS instance family are billed based on the provisioned ECS instance type, not the vCPU and memory that you requested.
ImportantAfter an ECI pod is created, you can run the
kubectl describe podcommand to view its details. Check thek8s.aliyun.com/eci-instance-specfield to confirm the actual ECS instance type used for billing. -
When specifying or excluding ECS instance families, the system cannot automatically select certain specialized instance types, such as GPU instance types (for example, gn6i) or instance types with a local disk (for example, i2g). To use these instance types, you must specify them directly. For more information, see Specify ECS instance types to create a pod.
-
This feature applies only when you specify vCPU and memory requirements. If you specify an exact ECS instance type, this annotation has no effect.
-
You can use this feature to create preemptible instances. In this scenario, the system considers both the order of the instance families in your configuration and the market price, prioritizing the price. If you have a strict requirement for a specific instance family, we recommend that you configure only one.
Configuration
Set the value for the k8s.aliyun.com/eci-instance-family annotation to one or more ECS instance families according to the following rules:
-
You can specify a comma-separated list of ECS instance families that are supported by ECI.
ImportantCurrently, 8th-generation instance types are available only for the Arm architecture. When you create a pod, you must use a nodeSelector to schedule the pod to an Arm-based node. Therefore, you cannot mix Arm-based and x86-based instance families in the same annotation value. When targeting Arm nodes, you can only specify or exclude other Arm-based families. For a configuration example, see Example 5: Specify an Arm-based instance family.
-
Prefix an instance family with a hyphen (
-) to exclude it.For example,
k8s.aliyun.com/eci-instance-family: "-ecs.c6, -ecs.c5"excludes the ecs.c6 and ecs.c5 instance families. -
If you specify multiple instance families, the system tries them in the order provided.
For example,
k8s.aliyun.com/eci-instance-family: "ecs.c6, ecs.c5"means the system first tries to select an instance type from the ecs.c6 family. If no suitable instance type with available inventory is found, it falls back to the ecs.c5 family. If the ecs.c5 family also lacks a suitable instance type, the pod creation fails.
When using the k8s.aliyun.com/eci-instance-family annotation, you must first specify the vCPU and memory. You can do this in one of the following ways:
-
Define requests or limits for a container. We recommend using limits.
-
Add the
k8s.aliyun.com/eci-use-specsannotation to the pod metadata.