我在 Azure VM 上启动并运行了一个 K8s 集群。
获取后:
java.io.IOException: Too many open files in system
在其中一个 Pod 上,我通过调用以下命令检查了打开文件限制:
ulimit -a | grep "open files"
在主机上(通过 ssh),并得到:
open files (-n) 1024
从 pod 内部(通过 'exec' pod),得到:
bash-4.3# ulimit -a | grep "open files"
open files (-n) 1048576
我的问题是如何可能有不同的值(pod“看到”比下划线主机更高的限制),以及哪个限制很重要 - 如果打开超过 1024 个打开的 fd,它会打破吗?
基于“alpine-java”的相关 Pod 镜像。
主机操作系统是:CentOS Linux 版本 7.4.1708
最佳答案
对于 Ulimit 选项,您应该从虚拟机上的 docker 单元文件更改它
[Service]
ExecStart=/usr/bin/dockerd \
--iptables=false \
--ip-masq=false \
--host=unix:///var/run/docker.sock \
--log-level=error \
--storage-driver=overlay \
--default-ulimit nofile=70000:70000 \
--default-ulimit nproc=70000:70000
Restart=on-failure
RestartSec=5
关于linux - kubernetes pods 显示与主机不同的 ulimit 打开文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48484875/