All Products
Search
Document Center

Overview

Last Updated: May 19, 2022

Elastic Container Instance can provide a basic pod runtime environment for Kubernetes clusters. Other capabilities such as dependencies between business, load balancing, auto scaling, and time-based scheduling still need to be provided by Kubernetes. This topic describes how to connect an elastic container instance to a self-managed Kubernetes cluster. This topic also describes how to implement the features of elastic container instances.

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 an elastic container instance to a Kubernetes cluster, the elastic container instance takes over the management of pods, including the infrastructure and resource 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 the elastic container instance. This helps improve resource utilization and ensures fast and flexible scalability. When business traffic slows down, you can release the elastic container instance to reduce resource 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 equivalent to native Kubernetes nodes. VNodes are integrated with components such as virtual-kubelet and kube-proxy and are compatible with the API operations for native Kubernetes nodes. When pods are scheduled to a VNode, the VNode automatically creates and manages underlying elastic container instance resources. Each pod runs on a dedicated elastic container instance that is deployed on a VNode. The following figure shows the hybrid architecture of self-managed Kubernetes cluster and elastic container instances: vnode

For more information about how to deploy a VNode, see Connect a self-managed Kubernetes cluster to a VNode.

Note

The virtual node feature is in public preview. To use this feature, submit a ticket.

Billing

You are charged for each VNode you create. Each VNode is equivalent to an elastic container instance that has 2 vCPUs and 8 GiB memory. You are charged based on equivalent number of elastic container 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 billed, and the unit prices of vCPUs and memory, see Billing.

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.

Item

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 modes

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 on the elastic container instances that are deployed on the VNodes. 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

    The ECI Profile feature allows you to customize selectors. Then, Elastic Container Instance automatically schedules pods that meet the conditions of the selectors to the VNode. For more information, see Configure an ECI Profile to orchestrate pods.

Use features of Elastic Container Instance

When you schedule pods of a Kubernetes cluster to Elastic Container Instance, 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. Annotations must be added to the metadata of pods. The following table describes common annotations:

Note

You can manually add annotations when you schedule pods. Alternatively, you can configure an Elastic Container Instance profile. Then, you can use the Elastic Container Instance Effect feature of the Elastic Container Instance profile to automatically append annotations to pods that have the labels. For information about how to configure Elastic Container Instance Effect, see Configure an Elastic Container Instance profile.

Annotation

Example

Description

k8s.aliyun.com/eci-vswitch

vsw-bp1xpiowfm5vo8o3c****

Specifies the IDs of vSwitches. You can specify multiple vSwitches to specify multiple zones.

k8s.aliyun.com/eci-use-specs

2-4Gi,4-8Gi,ecs.c6.xlarge

Specifies the elastic container instance types. You can specify multiple elastic container instance types. An elastic container instance type can be a combination of vCPUs and memory or an ECS instance type.

k8s.aliyun.com/eci-image-cache

"true"

Specifies whether to automatically match the image cache.

k8s.aliyun.com/eci-with-eip

"true"

Specifies whether to automatically create and associate an Elastic IP Address (EIP).

For information about annotations supported by Elastic Container Instance and configuration examples of the annotations, see Pod annotations supported by Elastic Container Instance.

Note

If exceptions occur when you use the features of Elastic Container Instance, you can view the event information. For more information, see Custom events of Elastic Container Instance.