Can I set ulimit for containers in k8s?

+1 vote

Any way i can set ulimit for containers in kubernetes?

Sep 14, 2018 in Kubernetes by shubham
• 6,500 points
1,015 views

4 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+1 vote

Since we use docker mostly for single processes, so there hasn't been an actual need for ulimit -u on it. On the other hand if you're just looking for resource limiting, kubernetes lets you do that. You can follow this doc:

https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/admin/resource-quota.md

answered Sep 14, 2018 by ajs3033
• 7,040 points
+1 vote

ssh into your Kubernetes cluster and modify the docker.service file. For an Amazon EKS cluster, the file is located at /usr/lib/systemd/system/docker.service. Append the property LimitMEMLOCK=infinity in the file and then restart docker using the following command

sudo service docker restart

This will spin up docker containers with an infinity memlock which is equivalent to

docker run -ulimit memlock=-1:-1 <docker image>
answered May 7 by Umer
+1 vote

You can set a DaemonSet with a privileged container setting the hosts ulimit. Something like this:

Example:

    image: image-name
    command: ["sh", "-c", "ulimit -n 65536"]
    securityContext:
      privileged: true
answered May 7 by Alok
+1 vote

You can either modify them via UserData for worker AutoScalingGroup (when using EKS AMI) or by building your own AMI.

Something like:

sudo sed -i "s|ExecStart=.*|ExecStart=/usr/bin/dockerd --default-ulimit memlock=83968000:83968000|g" /usr/lib/systemd/system/docker.service

sudo systemctl restart docker.service
answered May 7 by Inayat

Related Questions In Kubernetes

0 votes
1 answer

Can I run docker containers on different machines?

Yes, but you should also: create the relevant libnetworks in ...READ MORE

answered Oct 17, 2018 in Kubernetes by lina
• 8,100 points
31 views
0 votes
1 answer

How do I set up a k8s cluster on windows?

Hey @Nadia, follow these steps to create ...READ MORE

answered Feb 25 in Kubernetes by Roshan
19 views
0 votes
1 answer

Is possible to have same k8s service for multiple pods?

Reserve a static IP and then assign ...READ MORE

answered Jul 20, 2018 in Kubernetes by Kalgi
• 35,800 points
20 views
0 votes
1 answer

How can I access a service installed on Kubernetes from anywhere?

I have followed the link which you have ...READ MORE

answered Jul 23, 2018 in Kubernetes by Atul
• 10,200 points
73 views
0 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
631 views
0 votes
2 answers

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.