This topic describes how to configure virtual nodes and elastic container instances (ECIs) for an application that is deployed in a Kubernetes cluster.
Prerequisites
- The ECI service is activated. You can log on to the Elastic Container Instance console to activate the ECI service.
- The region where the cluster is deployed supports elastic container instances. To view the supported regions and zones, log on to the Elastic Container Instance console.
- The virtual node controller is installed in the Container Service for Kubernetes (ACK) cluster. For more information about how to install the virtual node controller, see Deploy the virtual node controller and use it to create Elastic Container Instance-based pods.
Limits
This feature is applicable only to ACK Managed Edition or ACK dedicated clusters that run Kubernetes 1.14 or later.
Schedule an EDAS application to virtual nodes
Method 1: Configure a pod tag
When you create or deploy an application in Enterprise Distributed Application Service (EDAS), set Label Configuration in the Advanced Settings step by setting Name to alibabacloud.com/eci and Value to true. Then, the pods of the application are scheduled to virtual nodes.

Method 2: Configure a namespace tag
Add the tag alibabacloud.com/eci=true to a Kubernetes cluster namespace. Then, new pods are scheduled to virtual nodes. This does not affect the pods that are already running.
Method 3: Configure ECI-based scheduling
When you create or deploy an application in EDAS, set Annotation Configuration in the Advanced Settings step by setting Name to alibabacloud.com/burst-resource and Value to one of the following options:
- eci: Elastic container instances are used when the resources on the real nodes of the cluster are insufficient.
- eci_only: Only elastic container instances are used.

Method 4: Configure priority-based resource scheduling
Configure Elastic Compute Service (ECS) and ECI hybrid scheduling for the Kubernetes application in EDAS with the application ID 933ff653-xxxx-xxxx-xxxx-d127a75cxxxx. When the resources on the real ECS nodes of the cluster are insufficient, pods are scheduled to virtual nodes.
apiVersion: scheduling.alibabacloud.com/v1alpha1
kind: ResourcePolicy
metadata:
name: edas-app-name // We recommend that you use the same name as the application in EDAS.
namespace: edas-app-namespace // Use the same namespace as the application in EDAS.
spec:
selector:
edas.appid: 933ff653-xxxx-xxxx-xxxx-d127a75cxxxx
strategy: prefer
units:
- resource: ecs
- resource: eciMethod 5: Use virtual-kubelet-autoscaler to schedule pods to elastic container instances
virtual-kubelet-autoscaler is a Kubernetes Autoscaler plug-in that is provided by Alibaba Cloud. If no matching node is available during pod scheduling (for example, if existing ECS work nodes are insufficient), virtual-kubelet-autoscaler will function and reschedule the pods that failed to be scheduled to elastic container instances (virtual nodes).
For more information about how to install the plug-in, see Install virtual-kubelet-autoscaler.
Method 6: Configure Elastic Container Instance Profile
Modify the ConfigMap that is named eci-profile in the kube-system namespace of the Kubernetes cluster.
Configure Elastic Container Instance Profile for the Kubernetes application whose application ID is 933ff653-xxxx-xxxx-xxxx-d127a75cxxxx. This configuration schedules the pods of the application to elastic container instances, automatically enables the image cache feature, and adds the created-by-eci label whose value is true.
apiVersion: v1
kind: ConfigMap
metadata:
name: eci-profile
namespace: kube-system
data:
vpcId: "vpc-xxx"
securityGroupId: "sg-xxx"
vswitchIds: "vsw-111,vsw-222"
enableClusterIp: "true"
enableHybridMode: "false"
enablePrivateZone: "false"
selectors: |
[
{
"name":"for-edas-app-1",
"objectSelector":{
"matchLabels":{
"edas.appid": 933ff653-xxxx-xxxx-xxxx-d127a75cxxxx
}
},
"effect":{ # The annotations and labels to be added.
"annotations":{
"k8s.aliyun.com/eci-image-cache": "true"
},
"labels":{
"created-by-eci":"true"
}
}
}
]For more information, see Configure Elastic Container Instance Profile.