How do I set ulimit for containers in Kubernetes?

后端 未结 4 557
渐次进展
渐次进展 2020-12-15 19:48

How do I set ulimit for containers in Kubernetes? (specifically ulimit -u)

4条回答
  •  猫巷女王i
    2020-12-15 20:28

    Above all not working for me.

    I done the following (it works on ubuntu:18.04 and centos/7):

    sudo nano /usr/lib/systemd/system/docker.service
    

    Added

    --default-ulimit memlock=-1:-1
    

    To line

    ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    

    This line must looks like:

    ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --default-ulimit memlock=-1:-1
    

    And then you MUST reload rightly: firstly run command

    sudo systemctl daemon-reload
    

    And then run command

    sudo systemctl restart docker.service
    

    To check work it or not works, run command

    docker run busybox:1.28 cat /proc/1/limits
    

    You must see unlimited max lock memory like about this:

    ...
    Max locked memory         unlimited            unlimited            bytes
    ...
    

    And elasticsearch starts to work!!!!

提交回复
热议问题