Skip to content

fix(kind): set containerd LimitNOFILE to 4096 to avoid valgrind failure#6337

Merged
oilbeater merged 1 commit intomasterfrom
fix/kind-containerd-limitnofile
Feb 25, 2026
Merged

fix(kind): set containerd LimitNOFILE to 4096 to avoid valgrind failure#6337
oilbeater merged 1 commit intomasterfrom
fix/kind-containerd-limitnofile

Conversation

@oilbeater
Copy link
Copy Markdown
Collaborator

Summary

  • Set LimitNOFILE=4096 for containerd on all Kind nodes after cluster creation
  • The default LimitNOFILE=infinity causes valgrind to fail with:
    libcfile Valgrind: FATAL: Private file creation failed.
    The current file descriptor limit is 1073741804.
    If you are running in Docker please consider
    lowering this limit with the shell built-in limit command.
    Exiting now.
    

Test plan

  • Run make kind-init to create cluster
  • Verify LimitNOFILE=4096 on all nodes: docker exec <node> grep LimitNOFILE /etc/systemd/system/containerd.service
  • Verify containerd is active: docker exec <node> systemctl status containerd

🤖 Generated with Claude Code

The default LimitNOFILE=infinity in Kind nodes causes valgrind to fail
with the following error:

  libcfile Valgrind: FATAL: Private file creation failed.
  The current file descriptor limit is 1073741804.
  If you are running in Docker please consider
  lowering this limit with the shell built-in limit command.
  Exiting now.

Set LimitNOFILE=4096 for containerd on all Kind nodes after cluster
creation to prevent this issue.

Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 25, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @oilbeater, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical issue where valgrind operations would fail within Kind clusters due to an excessively high default file descriptor limit for containerd. By programmatically setting a specific LimitNOFILE value, the stability and compatibility of the Kind environment for testing and development are significantly improved, preventing common libcfile errors.

Highlights

  • Containerd Configuration: The LimitNOFILE setting for containerd is now explicitly set to 4096 on all Kind nodes after cluster creation.
  • Valgrind Compatibility: This change addresses a fatal valgrind error that occurred due to the default LimitNOFILE=infinity setting, which caused private file creation to fail.
Changelog
  • makefiles/kind.mk
    • Added a loop to iterate through all Kind nodes after cluster creation.
    • Introduced commands to modify the containerd.service file on each node, changing LimitNOFILE=infinity to LimitNOFILE=4096.
    • Included steps to reload the systemd daemon and restart the containerd service on each node to apply the new limit.
Activity
  • The pull request was generated using Claude Code, indicating an AI-assisted creation process.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the bug Something isn't working label Feb 25, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively resolves the valgrind failure by correctly adjusting the LimitNOFILE setting for containerd on Kind nodes. The changes ensure that the containerd service is reconfigured and restarted after cluster creation, which directly addresses the problem described.

define kind_create_cluster
kind create cluster --config $(1) --name $(2)
@for node in $$(kind get nodes --name $(2)); do \
docker exec $$node sed -i 's/LimitNOFILE=infinity/LimitNOFILE=4096/' /etc/systemd/system/containerd.service; \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using sed -i to modify systemd service files can be brittle. If the format or content of /etc/systemd/system/containerd.service changes in a future update, the sed command might fail or produce unintended results. A more robust approach is to create a systemd drop-in file (override.conf) to apply specific settings. This method ensures that your changes are preserved and applied correctly, even if the main service file is updated.

		docker exec $$node mkdir -p /etc/systemd/system/containerd.service.d; docker exec $$node sh -c 'echo -e "[Service]\nLimitNOFILE=4096" > /etc/systemd/system/containerd.service.d/override.conf'; \

@oilbeater oilbeater merged commit 4fe155d into master Feb 25, 2026
74 of 76 checks passed
@oilbeater oilbeater deleted the fix/kind-containerd-limitnofile branch February 25, 2026 07:54
zhangzujian pushed a commit that referenced this pull request Mar 1, 2026
…re (#6337)

The default LimitNOFILE=infinity in Kind nodes causes valgrind to fail
with the following error:

  libcfile Valgrind: FATAL: Private file creation failed.
  The current file descriptor limit is 1073741804.
  If you are running in Docker please consider
  lowering this limit with the shell built-in limit command.
  Exiting now.

Set LimitNOFILE=4096 for containerd on all Kind nodes after cluster
creation to prevent this issue.

Signed-off-by: Mengxin Liu <liumengxinfly@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant