This topic describes how to specify Elastic Compute Service (ECS) instance types that use a local disk to create an Elastic Container Instance (ECI) pod.
Supported instance type families
A local disk is a local hard drive on the physical machine where the instance resides. Local disks offer low latency, high random input/output operations per second (IOPS), high throughput, and excellent value. However, because a local disk is part of a single physical machine, it is susceptible to single points of failure. For more information, see Local disks.
Local disks are part of a single physical machine. Therefore, data reliability depends on the reliability of the physical machine. This creates a risk of single points of failure. For more information, see Notes on local disks.
The following ECS instance families with local disks are supported:
Category | Instance family |
Local SSD | i4, i4g, i3, i3g, i2, i2g |
Big data | d1 |
Network-enhanced big data | d1ne |
GPU-accelerated compute-optimized | gn5 |
gn5 is a GPU-accelerated instance type. If you select this instance family, you must also specify GPU-related parameters in addition to local disk-related parameters.
For more information about ECS instance types, see the following topics:
Configurations
You can add the Kubernetes. aliyun.com/eci-use-specs annotation to the pod metadata to specify ECS instance types that use a local disk. When you mount your local disk, you can set the medium parameter to LocalRaid0 under EmptyDir to use the disk in a RAID 0 configuration and mount it to a specified path.
Example:
-
Run the following command to create a pod by specifying ECS instance types that use a local disk.
kubectl create -f localdisk-test.yamlThe following code provides an example in YAML format.
apiVersion: apps/v1 kind: Deployment metadata: name: localdisk-test labels: app: test spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: name: nginx-test labels: app: nginx alibabacloud.com/eci: "true" annotations: k8s.aliyun.com/eci-use-specs: "ecs.i2g.2xlarge,ecs.i2.xlarge" # Specify the supported ECS instance types with a local disk. You can specify up to five instance types. spec: containers: - name: nginx image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2 ports: - containerPort: 80 volumeMounts: - name: localdisk mountPath: /localdisk-test volumes: # Mount the local disk - name: localdisk emptyDir: medium: LocalRaid0 -
View the information about the mounted local disk.
After the pod is created, view the pod information. You can see that a RAID 0 configuration (
/dev/md0) is generated for the local disk, and the disk is mounted to the specified path, which is/localdisk-testin the following example.xxx:~$ kubectl get pod NAME READY STATUS RESTARTS AGE localdisk-test-5f8c979c48-j4bkj 1/1 Running 0 76s xxx:~$ kubectl exec -it localdisk-test-5f8c979c48-j4bkj -- bash root@localdisk-test-5f8c979c48-j4bkj:/# df -h Filesystem Size Used Avail Use% Mounted on overlay 30G 4.1G 26G 14% / tmpfs 64M 0 64M 0% /dev tmpfs 16G 0 16G 0% /sys/fs/cgroup /dev/md0 879G 77M 835G 1% /localdisk-test /dev/vda4 30G 4.1G 26G 14% /etc/hosts overlay 8.8G 4.9G 3.5G 59% /etc/hostname shm 64M 0 64M 0% /dev/shm tmpfs 32G 12K 32G 1% /run/secrets/kubernetes.io/serviceaccount tmpfs 16G 0 16G 0% /proc/acpi tmpfs 16G 0 16G 0% /sys/firmware