How do I set ulimit for containers in Kubernetes? (specifically ulimit -u)
By default, this is set to 1024. To find more options for limiting container CPU usage, please refer to Docker's official documentation.
Kubernetes doesn't provide default resource limits out-of-the-box. This means that unless you explicitly define limits, your containers can consume unlimited CPU and memory.
It appears that you can't currently set a ulimit but it is an open issue: https://github.com/kubernetes/kubernetes/issues/3595
If you are able to ssh into the kubernetes cluster, you can 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 the docker service.
sudo service docker restart
This would spin up docker containers with an infinite memlock value. Probably equivalent to
docker run -ulimit memlock=-1:-1 <docker image>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With