I'm new in kubernetes and I'm trying to deploy an elasticsearch on it. Currently, I have a problem with the number of file descriptor required by elasticsearch and allow by docker.
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
So to fix that I have tried 3 different ways:
From the docker documentation, dockerd should use the system value as default value.
/etc/security/limits.con
f with * - nofile 65536
ulimit -Hn && ulimit -Sn
return return 65536 twicedocker run --rm centos:7 /bin/bash -c 'ulimit -Hn && ulimit -Sn'
(should return 65536 twice but no, return 4096 and 1024 )--default-ulimit nofile=65536:65536
to /var/snap/microk8s/current/args/dockerd
docker run --rm centos:7 /bin/bash -c 'ulimit -Hn && ulimit -Sn'
(should return 65536 twice but no return 4096 and 1024)add
"default-ulimit" : { "nofile":{ "Name":" nofile", "Hard":" 65536", "Soft":" 65536" } }
to /var/snap/microk8s/354/args/docker-daemon.json
execute systemctl restart snap.microk8s.daemon-docker.service
journalctl -u snap.microk8s.daemon-docker.service -f
will return unable to configure the Docker daemon with file /var/snap/microk8s/354/args/docker-daemon.json: the following directives don't match any configuration option: nofile
The only way I found for set the ulimit is to pass --ulimit nofile=65536:65536
to the docker run command. But I cannot do that inside my kubernetes statesfullset config.
So do you know how I can solve this problem ? I didn't somethings wrong here ?
Thanks in advance for your help
ps: I'm on ubuntu 18.0.1 with docker 18.06.1-ce and microk8s installed with snap
A bit late but if someone has this problem too, you can add this line to /var/snap/microk8s/current/args/containerd-env
:
ulimit -n 65536
Then stop/start microk8s to enable this fix. If you execute command docker run --rm centos:7 /bin/bash -c 'ulimit -Hn && ulimit -Sn'
you can see 65536 twice
More information on Microk8s Github issue #253. Microk8s has merge a fix for this, it may will be soon available on a release.