How do I set ulimit for containers in Kubernetes? (specifically ulimit -u)
相关问题
- Microk8s, MetalLB, ingress-nginx - How to route ex
- How do I change the storage class of existing pers
- Use awslogs with kubernetes 'natively'
- Kubernetes coredns readiness probe failed
- Default certificate on Nginx-ingress
相关文章
- k8s 访问Pod 时好时坏
- Override env values defined in container spec
- How do I create a persistent volume claim with Rea
- How to obtain the enable admission controller list
- Difference between API versions v2beta1 and v2beta
- MountVolume.SetUp failed for volume “nfs” : mount
- How to save content of a configmap to a file with
- GKE does not scale to/from 0 when autoscaling enab
Considering Docker is designed for single processes for the most part
ulimit -u
doesn't exactly make sense. However, if you are looking for resource limiting in general, Kubernetes allows you to set a quota on a resource. Here are the docs: https://github.com/kubernetes/kubernetes/blob/release-1.0/docs/admin/resource-quota.md. This way you specify number of cores/memory/disk usage.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>
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.
Add following lines to /etc/docker/daemon.json
"default-ulimits": { "nofile": { "Name": "nofile", "Hard": 128000, "Soft": 128000 } }
and finally restart the docker service on that node by executing following command.
service docker restart
It appears that you can't currently set a ulimit but it is an open issue: https://github.com/kubernetes/kubernetes/issues/3595