ACK virtual nodes let you schedule pods directly to Elastic Container Instances (ECI) without provisioning or managing ECS nodes. Use virtual nodes when you need to scale quickly for traffic spikes or run short-lived compute jobs — ECI pods start on demand and you pay only for what you use.
This topic describes how to deploy the ack-virtual-node component in an ACK managed cluster and schedule pods to ECI.
Use cases
-
Traffic spikes: Online education and e-commerce services often experience sudden traffic surges. ECI-based pods scale up faster than ECS nodes and eliminate the need to maintain idle capacity.
-
Batch and AI workloads: For non-continuous jobs such as Spark and AI tasks, ECI removes the need to keep nodes running between executions. You pay only for compute resources consumed during task execution.
Prerequisites
Before you begin, make sure that:
-
Your ACK cluster runs Kubernetes 1.16 or later.
-
The region where your cluster is located supports ECI. Check Regions and zones supported by ECI, then log on to the Elastic Container Instance console to activate the ECI service.
Step 1: Deploy the ack-virtual-node component
These steps apply to an ACK managed cluster. For an ACK dedicated cluster, deploy ack-virtual-node from the Marketplace page instead. See Deploy the ack-virtual-node component.
-
Log on to the ACK console. In the left navigation pane, click Clusters.
-
On the Clusters page, click the name of the cluster you want to manage. In the left navigation pane, click Add-ons.
-
On the Component Management page, find ACK Virtual Node in the Core Components section, click Install, and follow the prompts. During installation, the cluster's default vSwitch and security group are used as the initial ECI configuration. To change these settings, update the eci-profile configuration.
Step 2: Schedule pods to ECI
Add the label alibabacloud.com/eci: "true" to a pod or a namespace to schedule it to a virtual node. Pods scheduled this way run on x86 architecture virtual nodes as ECI.
For additional scheduling options, see Schedule a pod to a virtual node.
Schedule a single pod to ECI
Add alibabacloud.com/eci: "true" directly to a pod's labels to schedule that pod to ECI.
-
Create a deployment:
This YAML uses the
k8s.aliyun.com/eci-use-specsannotation to set the pod's compute specification. For more options, see Specify the compute specification of an elastic container instance.kubectl create -f eci-pod.yamlThe following is an example
eci-pod.yaml:apiVersion: apps/v1 kind: Deployment metadata: name: test labels: app: test spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: name: test labels: app: nginx alibabacloud.com/eci: "true" # Schedule this pod to ECI annotations: k8s.aliyun.com/eci-use-specs: "2-4Gi" # 2 vCPUs, 4 GiB memory spec: containers: - name: nginx image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6 ports: - containerPort: 80 -
Verify that the pods are running on a virtual node:
kubectl get pod -o wide -l app=nginxThe
NODEcolumn shows the virtual node name when scheduling succeeds:NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES test-86f7fbc94f-g5m22 1/1 Running 0 38s 10.16.XX.XX virtual-kubelet-cn-hangzhou-j <none> <none> test-86f7fbc94f-r4wcn 1/1 Running 0 38s 10.16.XX.XX virtual-kubelet-cn-hangzhou-j <none> <none> -
Inspect the ECI pod:
-
k8s.aliyun.com/eci-instance-id— the ECI instance ID -
k8s.aliyun.com/eci-instance-spec— the actual billing specification
kubectl get pod <pod-name> -o yamlIn the returned YAML:
-
Schedule all pods in a namespace to ECI
Add alibabacloud.com/eci: "true" to a namespace to automatically schedule all pods in that namespace to ECI. This avoids adding the label to each pod individually.
-
Create a namespace named
vkand label it:kubectl create ns vk kubectl label namespace vk alibabacloud.com/eci=true -
Create a deployment in the
vknamespace:This YAML uses the
k8s.aliyun.com/eci-use-specsannotation to set the pod's compute specification. For more options, see Specify the compute specification of an elastic container instance.kubectl create -f eci-namespace.yamlThe following is an example
eci-namespace.yaml:apiVersion: apps/v1 kind: Deployment metadata: name: test namespace: vk # All pods in this namespace are scheduled to ECI labels: app: test spec: replicas: 2 selector: matchLabels: app: nginx template: metadata: name: test labels: app: nginx annotations: k8s.aliyun.com/eci-use-specs: "2-4Gi" # 2 vCPUs, 4 GiB memory spec: containers: - name: nginx image: anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/nginx:1.14.1-8.6 ports: - containerPort: 80 -
Verify that the pods are running on a virtual node:
kubectl get pod -o wide -l app=nginx -n vkThe
NODEcolumn shows the virtual node name when scheduling succeeds:NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES test-8f54bcfb5-86pvc 1/1 Running 0 14s 10.16.XX.XX virtual-kubelet-cn-hangzhou-j <none> <none> test-8f54bcfb5-skvkg 1/1 Running 0 14s 10.16.XX.XX virtual-kubelet-cn-hangzhou-j <none> <none> -
Inspect the ECI pod:
-
k8s.aliyun.com/eci-instance-id— the ECI instance ID -
k8s.aliyun.com/eci-instance-spec— the actual billing specification
kubectl get pod <pod-name> -o yaml -n vkIn the returned YAML:
-
What's next
-
Schedule without changing pod or namespace YAML: Configure an eci-profile with custom selectors to automatically route matching pods to ECI. This approach requires no changes to your application manifests.
-
Customize ECI pod behavior: Use annotations for ECI pods to specify compute specs, enable image caching to speed up pod creation, assign IPv6 addresses, or expand temporary storage — without changing Kubernetes semantics.