All Products
Search
Document Center

Elastic Container Instance:Schedule pods to a VNode

Last Updated:Apr 01, 2026

In self-managed Kubernetes clusters that use both real nodes and virtual nodes (VNodes), you can schedule pods to a VNode so they run as elastic container instances (ECIs). This topic covers two manual scheduling methods: configuring nodeSelector and tolerations, or specifying nodeName directly.

Both methods require modifying individual workload resources. For production environments, use the eci-profile component instead—it uses a label selector to automatically route matching pods to VNodes across all workloads, without per-workload changes. See Use eci-profile to schedule pods to a VNode.

Choose a scheduling method

MethodHow it worksWhen to use
nodeSelector + tolerationsMatches pods to VNodes by label and tolerates the VNode taintSchedule a group of pods to any available VNode (recommended for most cases)
nodeNamePins pods to a specific VNode by nameTesting or debugging on a known VNode

Method 1: Configure nodeSelector and tolerations

By default, VNodes carry the following label and taint:

labels:
  k8s.aliyun.com/vnode: "true"
taints:
- effect: NoSchedule
  key: k8s.aliyun.com/vnode
  value: "true"

To schedule pods to VNodes, set nodeSelector to match the label and add a toleration for the NoSchedule taint.

Prerequisites

Before you begin, ensure that you have:

  • A self-managed Kubernetes cluster with at least one VNode (verify with kubectl get nodes)

  • kubectl configured to connect to the cluster

Steps

  1. Save the following content as deploy-vnode-test1.yaml.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: vnode-nginx-test1
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: uid
      template:
        metadata:
          labels:
            app: uid
        spec:
          nodeSelector:          # Match VNodes by label
            k8s.aliyun.com/vnode: "true"
          tolerations:           # Tolerate the VNode NoSchedule taint
          - key: k8s.aliyun.com/vnode
            operator: "Equal"
            value: "true"
            effect: "NoSchedule"
          containers:
          - name: nginx
            image: registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2
  2. Apply the Deployment.

    kubectl apply -f deploy-vnode-test1.yaml

Method 2: Specify nodeName

Specifying nodeName bypasses the Kubernetes scheduler and pins pods directly to a named VNode.

Prerequisites

Before you begin, ensure that you have:

  • A self-managed Kubernetes cluster with at least one VNode

  • kubectl configured to connect to the cluster

  • The exact name of the target VNode

Steps

  1. Get the VNode name.

    kubectl get nodes

    VNode names follow the format <region>.<VNode ID>. Sample output:

    NAME                                    STATUS   ROLES                  AGE    VERSION
    cn-hangzhou.vnd-2ze2qhf8lmp5kgsx****   Ready    agent                  132m   v1.20.6
    k8s-master                             Ready    control-plane,master   169m   v1.20.6
  2. Save the following content as deploy-vnode-test2.yaml. Replace cn-hangzhou.vnd-2ze2qhf8lmp5kgsx**** with your VNode name.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: vnode-nginx-test2
    spec:
      replicas: 2
      selector:
        matchLabels:
          app: uid
      template:
        metadata:
          labels:
            app: uid
        spec:
          nodeName: cn-hangzhou.vnd-2ze2qhf8lmp5kgsx****   # Replace with your VNode name
          containers:
          - name: nginx
            image: registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2
  3. Apply the Deployment.

    kubectl apply -f deploy-vnode-test2.yaml

Next steps