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
• 7,340 points
18,724 views

4 answers to this question.

+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,300 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, 2019 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, 2019 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, 2019 by Inayat

Related Questions In Kubernetes

0 votes
2 answers
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, 2019 in Kubernetes by Roshan
638 views
0 votes
1 answer

Can I configure my kubernetes job to run for a specified time?

When we create a job spec, we ...READ MORE

answered Jul 17, 2019 in Kubernetes by Sirajul
• 59,230 points
1,344 views
0 votes
1 answer

how can i access two containers that are inside a pod from the browser with IP address?

Just do port forward. kubectl port-forward [nginx-pod-name] 80:80 kubectl ...READ MORE

answered Jul 18, 2019 in Kubernetes by Sirajul
• 59,230 points
2,056 views
+2 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
3,925 views
0 votes
2 answers

Using a local image to create a pod in K8s

I'm not sure but you can try ...READ MORE

answered Apr 29, 2019 in Kubernetes by Vishaka
19,716 views
0 votes
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP