一个伪linux粉丝的blog
  1. 首页
  2. unix/linux
  3. 正文

"too many open files" from kubectl logs

2020年03月25日 938点热度 0人点赞 0条评论

昨天在查看k8s集群机器上的某个pod日志的时候发现最后一行提示failed to create fsnotify watcher: too many open files

虽然不影响我查看日志,但是这样的提示总归影响体验,想着解决。

翻到一篇中文介绍 Kubernetes - 专治疑难杂症

这是因为系统默认的fs.inotify.max_user_instances=128太小,需要重新设置此值:

  • 重新设置此值:

sudo sysctl fs.inotify.max_user_instances=8192

2020-07-30更新

几个月后发现,重启后,那个值消失了,还是在配置文件里面改吧,1行命名解决。
echo fs.inotify.max_user_instances=8192| tee -a /etc/sysctl.conf && sudo sysctl -p

类似报错Registration of the raw container factory failed: inotify_init: too many open files,也可以做类似修改。

 

改完查看日志,依然报错,并无效果,中途还查看了ulimit -a的几个其他限制,默认值都很大。

最后翻到  https://bugzilla.redhat.com/show_bug.cgi?id=1605153

on master
# sysctl -a | grep fs.inotify.max_user_
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536

on node:
# sysctl -a | grep fs.inotify.max_user_
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536

看的这段才想起查看所查日志的所在节点并没有修改。
kubectl get po -n default -o wide

NAME                                READY     STATUS    RESTARTS   AGE       IP               NODE
myapp-nginx-7655b75998-x8vqf        1/1       Running   2          15d       172.28.106.215   vps1-s1
openldap-6f64b56c6c-5l8ks           1/1       Running   1          132d      172.28.106.235   vps1-s1
phpldapadmin-5655bcf9b5-454sk       1/1       Running   1          132d      172.28.106.237   vps1-s1
postgres-postgres-d7b5449c9-cxdhs   1/1       Running   0          68d       172.28.235.65    vps1-m1
rabbitmq-rabbitmq-65f8d79bf-zdwrp   1/1       Running   2          67d       172.28.106.210   vps1-s1
redis-redis-5c8b847b8f-tpv4d        1/1       Running   0          6d        172.28.106.218   vps1-s1

找到想查pod所在节点,然后登录查看并修改即可。


Related posts:

  1. iWatch monitor ftp site file created and send mail
  2. docker-upgrade
  3. download files from qiniu
  4. plowshare -- command-line application to download files for file-sharing websites
标签: kubectl logs
最后更新:2020年07月30日

WanJie

正经人谁写博客啊?你写博客吗?写出来的那能叫博客?

点赞
< 上一篇
下一篇 >

文章评论

取消回复

分类目录
  • network
  • Uncategorized
  • unix/linux
  • 业界资讯
  • 公司杂事
  • 数码影像
  • 美剧
  • 美图共赏
  • 英语学习

COPYRIGHT © 2008-2021 一个伪linux粉丝的blog. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS