This topic describes how to resolve insufficient shared memory issues in an Elastic Container Instance (ECI) Pod. You can increase the shm size by setting the sizeLimit of a memory-type emptyDir volume and mounting it to /dev/shm.
Use cases
By default, Kubernetes allocates 64 MiB of shared memory to each Pod, which sets the size of the /dev/shm directory to 64 MiB. Kubernetes configurations do not allow you to change this size

To work around this limitation, you can increase the shm size by mounting a memory-type emptyDir volume to /dev/shm.
Configuration example
Create a YAML file.
vim emptydir-shm.yamlThe following example shows the content of the
emptydir-shm.yamlfile. This configuration increases the pod'sshmsize to 256 MiB by mounting a memory-typeemptyDirvolume with a256MiBsizeLimitto the/dev/shmdirectory.apiVersion: apps/v1 kind: Deployment metadata: name: test labels: app: test spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: name: nginx-test labels: app: nginx alibabacloud.com/eci: "true" spec: containers: - name: nginx image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2 ports: - containerPort: 80 volumeMounts: - mountPath: /dev/shm name: cache-volume volumes: - emptyDir: medium: Memory sizeLimit: 256MiB name: cache-volumeCreate the Deployment.
kubectl create -f emptydir-shm.yamlView the results.
Log on to the container and run the
df -hcommand to check the disk space. The output confirms that the size of/dev/shmis now 256 MiB.