The system may exhaust instances of specified types or vSwitch IP resources in a zone when it attempts to create sufficient instances to handle traffic spikes or process a large number of jobs in parallel. As a result, you fail to create Elastic Container Instances (ECIs) in the zone. In this case, you can deploy a serverless Kubernetes (ASK) cluster across multiple zones to prevent resource shortage.

Background information

  • An ECI distributes the requests for creating pods to all vSwitches. This balances the heavy load.
  • If the zone of a vSwitch does not have sufficient resources to create the required pods, the system selects another vSwitch.

Procedure

  1. When you create an ASK cluster, you can select an existing virtual private cloud (VPC) and specify multiple vSwitches deployed in different zones. For more information about how to create a cluster, see Create an ASK cluster.
    Cross-zone ASK
  2. Modify the configuration of zones for a cluster.
    After the ASK cluster is created, modify the vSwitch configuration for the cluster. You do not need to recreate the cluster. Run the following command and modify the vswitch field in kube-system/eci-profile configmap based on your business requirements. The modification immediately takes effect.
    kubectl -n kube-system edit cm eci-profile
    apiVersion: v1
    data:
      kube-proxy: "true"
      privatezone: "true"
      quota-cpu: "192000"
      quota-memory: 640Ti
      quota-pods: "4000"
      region: cn-hangzhou
      resourcegroup: ""
      securitygroup: sg-xxx
      vpc: vpc-xxx
      vswitch: vsw-xxx,vsw-yyy,vsw-zzz
    kind: ConfigMap

FAQ

  • How do I add nodes to an ASK cluster?

    The concept of node is not applied to ASK clusters. To deploy ECIs in other zones, you can add a vSwitch of another zone to the eci-profile ConfigMap of the kube-system namespace. Separate vSwitches with commas (,).

  • How do I deploy pods in different zones?

    By default, pods are randomly scheduled to zones that have sufficient resources.

    Match virtual kubelet. You can deploy ECIs of different instance types across zones by using the following three annotations:
    • - k8s.aliyun.com/eci-schedule-strategy: "VSwitchOrdered"
    • - k8s.aliyun.com/eci-vswitch: "vsw-11111, vsw-22222"
    • - k8s.aliyun.com/eci-use-specs: "ecs.c5.4xlarge, ecs.c6.4xlarge,2-4Gi"

    VSwitchOrdered specifies that ECIs are created based on the vSwitch list in the k8s.aliyun.com/eci-vswitch annotation. You can set k8s.aliyun.com/eci-schedule-strategy to VSwitchRandom or VSwitchOrdered. When you create an ECI, the ECI is randomly scheduled to a zone or scheduled based on the vSwitch list specified by the k8s.aliyun.com/eci-vswitch annotation.