This topic describes how to create Elastic Container Instances (ECIs) with local disks and the limits on using ECIs with local disks.

For more information about local disks, see Local disks.

Instance types that support local disks

You can create ECIs with local disks by specifying Elastic Compute Service (ECS) instance types with local disks. The following ECS instance families are supported:

  • d1, big data instance family. Example: ecs.d1.2xlarge.
  • d1ne, big data instance family with enhanced network performance. Example: ecs.d1ne.2xlarge.
  • i1, instance family with local SSDs. Example: ecs.i1.xlarge.
  • i2, instance family with local SSDs. Example: ecs.i2.xlarge.
  • i2g, instance family with local SSDs. Example: ecs.i2g.2xlarge.

For more information, see Instance families.

Kubernetes mode

You can specify ECS instance types with local disks in the k8s.aliyun.com/eci-use-specs annotation of a pod to be created.

  • Add the annotation that specifies the instance types in the metadata parameter for the pod.
  • A local disk has the same lifecycle as the ECI to which it is mounted. Therefore, you cannot mount local disks as persistent volumes (PVs). You can set the driver parameter to alicloud/local-disk in the YAML file to mount a local disk by using FlexVolume.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-i2
  labels:
    app: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
      annotations:
        k8s.aliyun.com/eci-use-specs: "ecs.i2.4xlarge"  # Replace the ECS instance type as needed.
    spec:
      containers:
      - name: nginx
        image: nginx
        volumeMounts:
          - name: disk1
            mountPath: "/data1"
          - name: disk2
            mountPath: "/data2"
      volumes:
        - name: disk1
          flexVolume:
            driver: "alicloud/local-disk"
            fsType: "ext4"
        - name: disk2
          flexVolume:
            driver: "alicloud/local-disk"
            fsType: "ext4"

API mode

CreateContainerGroup

To create ECIs with local disks, specify ECS instance types with local disks in the InstanceType parameter.

Request parameter

Parameter Type Required Description
InstanceType String No The instance type of the ECI to be created.

Volume parameter

Parameter Type Required Description
Name String No The name of the volume.
Type String No The type of the volume. Set the value to FlexVolume.
FlexVolume.FsType String No The type of the file system. Valid values: ext3, ext4, and xfs.
FlexVolume.Driver String No The driver for using the disk. Set the value to alicloud/local-disk.
Note You must set the FlexVolume.Driver parameter to alicloud/local-disk.
Notice 1. The specifications and quantity of local disks are determined by the ECS instance type that is specified by the InstanceType parameter. If the number of local disks declared as volumes exceeds the maximum number of the disks supported by the specified instance type, an error message is returned.

2. If the specified type of ECS instance has multiple local disks, you can mount the local disks in any order because these local disks have the same specifications.

3. A local disk resides on a single physical server, which faces the risk of single point of failure (SPOF). For more information, see Local disks.