0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

EC2でk8s構築時に、Too Many Open Filesエラーの対応(忘備録)

Last updated at Posted at 2023-12-28

前編

経緯

  1. Fluent Bitを起動した後、開発者のための環境を増やしたときに、ログを収集するインスタンスが多くなり、一部のPODが起動してなかった
    ...エラー...
    2023/12/27 12:09:25 too many open files
    ...エラー...
    

対応

下記の二つのファイルを確認し、制限されている数値を増やすことで解決

  1. max_user_watchesを確認

    $ cat /proc/sys/fs/inotify/max_user_watches
    
  2. max_user_instancesを確認

    $ cat /proc/sys/fs/inotify/max_user_instances
    
  3. 自分の場合、二つのファイルの中で、max_user_instancesが 128になっており、これを増やすことで問題解決した

    # 制限されている instanceの数を増やす
    $ sudo sysctl fs.inotify.max_user_instances=1024
    $ sudo sysctl -p
    
  4. 永久適応する場合
    /etc/sysctl.conffs.inotify.max_user_instancesを修正

    例)

    $ cat  /etc/sysctl.conf
    # sysctl settings are defined through files in
    # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
    #
    # Vendors settings live in /usr/lib/sysctl.d/.
    # To override a whole file, create a new file with the same in
    # /etc/sysctl.d/ and put new settings there. To override
    # only specific settings, add a file with a lexically later
    # name in /etc/sysctl.d/ and put new settings there.
    #
    # For more information, see sysctl.conf(5) and sysctl.d(5).
    fs.inotify.max_user_watches=99524288
    fs.file-max = 992097152
    fs.inotify.max_user_instances=9999999
    $
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?