Skip to content

Conversation

@ngopalak-redhat
Copy link
Contributor

@ngopalak-redhat ngopalak-redhat commented Nov 3, 2025

This PR adds a new node_files MCP tool that enables AI assistants like Claude to perform file operations on Kubernetes node filesystems through temporary privileged pods.

Motivation

AI tools are effective at identifying the specific node files needed for debugging (e.g., kernel configs, system logs, cgroup settings). However, the manual workflow of creating privileged debug pods and copying files is time-consuming and repetitive. While kubectl cp and kubectl debug achieve the same goal, they require constant monitoring and are slower when fetching multiple files (10-15+) for analysis.

Key Features

  • Three operations: put (copy to node), get (copy from node), list (directory listing)
  • Auto-cleanup: Temporary privileged pod is automatically deleted after operation
  • Configurable:
    • namespace: Defaults to default (not all clusters allow privileged pods in all namespaces)
    • image: Defaults to busybox (organizations can specify approved images)
    • privileged: Can be toggled if needed

Use Cases

  1. Rapid multi-file debugging: Fetch and analyze 10-15 files together for comprehensive troubleshooting
  2. Verification: Quickly verify configuration changes applied to nodes
  3. Monitoring: Use list operation to monitor file creation/changes
  4. Privileged file access: Access files requiring privileged permissions (note: use nodes_log for standard logging via kubelet proxy)

Note: I didn't add any zipping feature as I observed in most cases the files fetched need to analyzed by other AI tool. Zipping slows it down. It can be considered later.

Performance

Significantly faster than manual debug pod creation - the MCP server handles pod lifecycle automatically, allowing Claude to focus on analysis rather than cluster operations.

Examples

Get node system information:
  Get /proc/cpuinfo and /proc/meminfo from node ip-10-0-119-110.ec2.internal

  Debug cgroup settings:
  Get /sys/fs/cgroup/memory.max from node ip-10-0-50-25.ec2.internal
  Verify memory limits applied at the cgroup level.

  Monitor kubelet configuration changes:
  List /etc/kubernetes/kubelet.conf on all nodes
  Verify if kubelet config updates were rolled out correctly.

@ngopalak-redhat ngopalak-redhat changed the title Support to put,get and list files on k8s node Add node_files tool for privileged node filesystem operations Nov 3, 2025
@ngopalak-redhat ngopalak-redhat marked this pull request as ready for review November 3, 2025 04:00
@ngopalak-redhat
Copy link
Contributor Author

/assign @manusa This is similar to the other PRs you have been reviewing in the nodes.

Signed-off-by: Neeraj Krishna Gopalakrishna <ngopalak@redhat.com>
Signed-off-by: Neeraj Krishna Gopalakrishna <ngopalak@redhat.com>
@ngopalak-redhat
Copy link
Contributor Author

@manusa thank you very much for your reviews on the previous PRs. I've rebased this PR and moved the test to a different file, similar to the earlier PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant