All Products
Search
Document Center

Elastic Container Instance:Connect a self-managed Kubernetes cluster to Elastic Container Instance

Last Updated:Mar 21, 2024

Elastic Container Instance can be used to provide a basic pod runtime environment for Kubernetes clusters. Other capabilities such as dependencies between services, load balancing, auto scaling, and regular scheduling must still be provided by Kubernetes. This topic describes how to connect a self-managed Kubernetes cluster to Elastic Container Instance. This topic also describes how to implement the features of Elastic Container Instance.

Connection method

Elastic Container Instance provides a hierarchical solution to manage Kubernetes resources. Elastic Container Instance schedules and manages pods at the infrastructure layer, whereas Kubernetes manages workloads such as Deployments, Services, StatefulSets, and CronJobs on the platform layer.

After you connect Kubernetes clusters to Elastic Container Instance, Elastic Container Instance takes over the management of pods, including the infrastructure and resources availability. Kubernetes no longer needs to manage the lifecycle and resources of the underlying virtual machines (VMs). You can schedule the excess traffic of long-running workloads to an elastic container instance. This allows you to reduce idle resources and ensure fast and flexible scalability. When business traffic decreases, the Kubernetes cluster can release the pods deployed in Elastic Container Instance to reduce costs.

If you have self-managed Kubernetes clusters in a data center or on Alibaba Cloud Elastic Compute Service (ECS), you can deploy virtual nodes (VNodes) to use elastic container instances. VNodes are connected to native Kubernetes nodes. VNodes have components such as virtual-kubelet and kube-proxy built in and are compatible with native Kubernetes API. After pods are scheduled to a VNode, the VNode automatically creates and manages underlying elastic container instance resources. Each pod that is deployed on a VNode runs as an elastic container instance. The following figure shows the hybrid architecture of self-managed Kubernetes clusters and elastic container instances: vnode

For information about how to connect a VNode to a self-managed Kubernetes cluster, see:

Billing

You are charged for each VNode that you create. Each VNode has one resident node and is equivalent to an elastic container instance that provides 2 vCPUs and 8 GiB memory. You are charged based on the equivalent number of instances.

The following formula is used to calculate the price of one VNode: The price of one VNode = (2 × Unit price of vCPUs + 8 × Unit price of memory) × Run duration.

For information about how elastic container instances are priced, and the unit prices of vCPUs and memory, see Billing overview.

Note

VNodes provide the tagging feature. You can bind tags to VNodes. Then, you can separately calculate the costs of VNodes and elastic container instances based on the tags.

Limits

Elastic Container Instance does not support some Kubernetes features such as hostPaths and DaemonSets due to security limits of Alibaba Cloud public cloud and limits imposed by virtual nodes. The following table describes the unsupported features.

Unsupported feature

Description

Recommended alternative

HostPath

Allows you to mount files from on-premises hosts to containers.

Use emptyDir volumes, disks, or Apsara File Storage NAS (NAS) file systems.

HostNetwork

Allows you to map a host port to a container.

Create a Service of the LoadBalancer type.

DaemonSet

Allows you to deploy a static pod on the host of a container.

Deploy multiple images in a pod by using sidecar containers.

Privileged permissions

Allows you to grant privileged permissions to a container.

Use a security context to grant permissions to a pod.

Service of the NodePort type

Allows you to map a host port to a container.

Create a Service of the LoadBalancer type.

Scheduling mode

For Kubernetes clusters that use both real nodes and VNodes, you can schedule pods to VNodes based on your business requirements and then run the pods as elastic container instances. The main scheduling modes include:

  • Manual scheduling

    You can configure the nodeSelector and tolerations parameters or specify the nodeName parameter to schedule pods to the VNode. For more information, see Schedule pods to a VNode.

  • Automatic Scheduling

    After you deploy the eci-profile component, you can specify the Selector parameter. This way, the system automatically schedules pods that meet the conditions specified by Selector to the VNode. For more information, see Use eci-profile to schedule pods to a VNode.

Implement the features of Elastic Container Instance

When you schedule pods of a Kubernetes cluster to run on elastic container instances, you can add annotations to the pods to make full use of the features of Elastic Container Instance. Make sure that the annotations that you want to add comply with the Kubernetes syntax. You must add annotations to the metadata in the configuration files of the pods. For information about the annotations that you can add and configuration examples of the annotations, see Pod annotations.

Note

You can manually add annotations when you create pods. You can also configure the eci-profile component. eci-profile automatically adds annotations to pods that have the specified labels.