Kubernetes can't start due to too many open files in system
You can confirm which process is hogging file descriptors by running:
lsof | awk '{print $2}' | sort | uniq -c | sort -n
That will give you a sorted list of open FD counts with the pid of the process. Then you can look up each process w/
ps -p <pid>
If the main hogs are docker/kubernetes, then I would recommend following along on the issue that caesarxuchao referenced.
Kubernetes - Too many open files
May you have a look at https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/
You but you need enable few features to make it work.
securityContext:
sysctls:
- name: fs.file-max
value: "YOUR VALUE HERE"
Socket accept - Too many open files
There are multiple places where Linux can have limits on the number of file descriptors you are allowed to open.
You can check the following:
cat /proc/sys/fs/file-max
That will give you the system wide limits of file descriptors.
On the shell level, this will tell you your personal limit:
ulimit -n
This can be changed in /etc/security/limits.conf - it's the nofile param.
However, if you're closing your sockets correctly, you shouldn't receive this unless you're opening a lot of simulataneous connections. It sounds like something is preventing your sockets from being closed appropriately. I would verify that they are being handled properly.
Docker error: too many open files
Default limit of number of open files is 1024. You can increase it in two ways:
Run the container with
--ulimit
parameter:docker run --ulimit nofile=5000:5000 <image-tag>
Run the container with
--privileged
mode and executeulimit -n 5000
.
You can find more information here.
Related Topics
Docker: Ssh Access Directly into Container
Iptables Script to Block All Internet Access Except for Desired Applications
In Linux, Schedule Task to Hour, Minute, Second Precision
Error Marking Master: Timed Out Waiting for the Condition [Kubernetes]
How to Get Only Filenames Without Path by Using Grep
Perl: What Does Checkstack.Pl in Linux Source Do
Save Modifications in Place with Non Gnu Awk
Does Using Xvfb to Run Opengl Effects Version
Analyzing CPU Registers During Kernel Crash Dump
How to Replace Finding Words with the Different in Each Occurrence in Vi/Vim Editor
Temporarily Prevent Linux from Shutting Down
Windows Equivalent of ./ (Current Directory)
Arm Assembly "Retne" Instruction
Why Does If [ !$(Grep -Q) ] Not Work When If Grep -Q Does
Lazarus: How to List All the Available Network Connection on a System
How to Kill All Child Processes Without Killing the Parent