-
Notifications
You must be signed in to change notification settings - Fork 195
Add node_files tool for privileged node filesystem operations #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add node_files tool for privileged node filesystem operations #430
Conversation
cdff82e to
7e37a1e
Compare
|
/assign @manusa This is similar to the other PRs you have been reviewing in the nodes. |
11f0bd1 to
eb6eb1c
Compare
|
@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. |
82d2d3d to
9a56372
Compare
|
@manusa I still believe this provides value. Would you be open to reconsidering this? |
Signed-off-by: Neeraj Krishna Gopalakrishna <ngopalak@redhat.com>
Signed-off-by: Neeraj Krishna Gopalakrishna <ngopalak@redhat.com>
9a56372 to
24c91e7
Compare
| if opts.Namespace == "" { | ||
| opts.Namespace = "default" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other operations we're using the k.NamespaceOrDefault method.
I'm not sure if this would apply here too.
| if opts.Image == "" { | ||
| opts.Image = "busybox" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the purpose of the tool/feature is to perform file operations is there any value in being able to customize the used image?
I understand, that changing the image might also break the implementation. Wouldn't it be better to use a specific image that can be freely pulled and that worked on any cluster?
| } | ||
|
|
||
| // Create the pod | ||
| pods, err := k.AccessControlClientset().Pods(opts.Namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: this is a good candidate to try out MCP progress notifications (Not in this PR)
| } | ||
|
|
||
| // nodeFilesPut copies a file from local filesystem to node filesystem | ||
| func (k *Kubernetes) nodeFilesPut(ctx context.Context, namespace, podName, sourcePath, destPath string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the copy operations we should probably replicate what kubectl does to ensure the behavior is consistent:
https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/cp/cp.go
Personally, I've had some bad experiences with the implementation of these operations in the Fabric8 Kubernetes Client
Hi, @ngopalak-redhat I added a few comments. |
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
Use Cases
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