Elastic Container Instance can provide basic container runtimes for Kubernetes pods. Each elastic container instance is a pod. This topic describes how to configure and create a pod. This topic also describes the lifecycle of a pod.
Elastic Container Instance is connected to Kubernetes based on VNodes and the Virtual Kubelet technology that is provided by the Kubernetes community. An elastic container instance involves the following configurations:
The specifications include vCPUs and memory configurations that define the computing performance of pods. When you create a pod, you can specify the specifications of the pod, such as the number of vCPUs and memory size. You can also specify an Elastic Compute Service (ECS) instance type to meet special requirements, such as those for GPUs and local disks.
A pod can contain up to 20 containers. Before you deploy a container application, you must prepare a container image. A container image contains the programs, library files, and configurations that are required to run containerized applications. Before you pull images, make sure that the network is accessible. We recommend that you use the image cache feature to shorten the startup time of the pod.
A pod uses one elastic network interface (ENI) of a vSwitch in the virtual private cloud (VPC) to which the pod belongs. By default, a pod is assigned an internal IP address. If a pod needs to access the Internet, for example, if you want to pull public images, you must associate an elastic IP address (EIP) with the pod, or associate a network address translation (NAT) gateway with the VPC to which the pod belongs.
By default, a pod provides 20 GiB of memory for temporary storage. You can increase the memory size for temporary storage based on your business requirements. If you want to retain the stored files, we recommend that you mount external volumes. You can mount Alibaba Cloud storage volumes, such as disks, Apsara File Storage NAS (NAS) file systems, and Object Storage Service (OSS) buckets.
You can use two methods to create pods based on your business and usage scenarios. These methods correspond to different billing modes.
Specify the number of vCPUs and memory size
You are charged for pods based on the vCPU and memory specifications that you specify when you create the pods. For vCPU and memory specifications that are not supported, the system adjusts the instance specifications and charges you based on the new specifications.
Specify an ECS instance type
You are charged for pods based on the ECS instance types that you specify when you create the pods. When you create pods, you can specify ECS instance families based on your business requirements. For example, you can specify the ecs.sn1ne instance family to create pods that provide enhanced network performance.
For more information about billing, see Billing of elastic container instances.
Optimize usage costs of pods
You can use pay-as-you-go elastic container instances together with preemptible elastic container instances, reserved instances, and savings plans to reduce your costs based on your business requirements.
Preemptible elastic container instances can be used for stateless and fault-tolerant business workloads. For more information, see Create a preemptible elastic container instance.
For long-term stable business workloads, we recommend that you use reserved instances or savings plans to offset the bills of elastic container instances. The following methods can be used to offset your bills based on the billing modes of elastic container instances:
Pods for which you are charged based on the number of vCPUs and memory size: General-purpose or elastic savings plans can be used.
Pods for which you are charged based on ECS instance types: General-purpose savings plans, ECS compute savings plans, and reserved instances can be used.
Respond to insufficient resources
Elastic Container Instance provides cloud resources for containers. When you create a large number of pods, some resources in the specified region and zone may be insufficient. We recommend that you specify multiple ECS instance types across multiple zones to ensure that the pods can be created. For more information, see the following topics:
Customize CPU options
The CPU options of a pod include the number of physical CPU cores and the number of threads per core. You can customize CPU options for some pods to obtain higher CPU-to-memory ratios. This is determined by how the pods are created. For more information, see Customize CPU options.
In the lifecycle of pods, the pods have different states in different stages. For more information about the states of pods in Elastic Container Instance and the corresponding states of Kubernetes pods, see Lifecycle of a pod.