Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase shm size of a kubernetes container (--shm-size equivalent of docker)

By default docker uses a shm size of 64m if not specified, but that can be increased in docker using --shm-size=256m

How should I increase shm size of a kuberenetes container or use --shm-size of docker in kuberenetes.

like image 568
anandaravindan Avatar asked Apr 12 '17 15:04

anandaravindan


People also ask

How do I increase my dev SHM in docker?

You can modify shm size by passing the optional parameter --shm-size to docker run command. The default is 64MB.

What is SHM size docker?

You can now use the Docker shm-size and tmpfs parameters in Amazon Elastic Container Service (Amazon ECS) task definitions. The shm-size parameter allows you to specify the shared memory that a container can use. It enables memory-intensive containers to run faster by giving more access to allocated memory.

How do I increase Ulimit in Kubernetes?

In Kubernetes cluster (AWS EKS) you can change the ulimit for a docker container by modifying the /etc/docker/daemon. json in the node where your container is running.

Why pod is smallest unit in Kubernetes?

Technically a container is an even smaller unit because a pod can contain multiple containers, but you can not deploy a single container, only a pod with one container. That's why the pod is considered the smallest unit in kubernetes.


2 Answers

I originally bumped into this post coming from google and went through the whole kubernetes issue and openshift workaround. Only to find the much simpler solution listed on another stackoverflow answer later.

like image 83
Glenn Vandamme Avatar answered Sep 18 '22 11:09

Glenn Vandamme


added below line in deployment.yaml and container came up for me which was failing-
basically Mounting an emptyDir to /dev/shm and setting the medium to Memory

   spec:      containers:        - name: solace-service          image: solace-pubsub-standard:latest          volumeMounts:            - mountPath: /dev/shm              name: dshm          ports:            - containerPort: 8080      volumes:        - name: dshm          emptyDir:             medium: Memory 
like image 33
kumar Avatar answered Sep 21 '22 11:09

kumar