How to use the exec module to issue kubectl commands to control the cluster

I want to use the exec module in nodered to call kubectl commands outside the system. I have successfully called external docker commands by creating nodered containers with some docker files mounted to the outside, but calling k8s commands has not been done.

Do the commands need sudo in order to run?

No, I think as long as I can run kubectl to create a pod

What is the command you are trying to run? If you are not already doing so then give the full path to the command.

Add debug nodes to all outputs of the exec node and see what comes out.

It is better to use separate debug nodes and give them names so you can identify them in the output. Also you should have set them to Output complete message. However you can see yourself what the problem is. It appears that you may not have followed my previous advice which was:

I don't quite understand what you mean

If you go to a command line for your server, type in whereis kubectl, it will tell you where the file that is run for that command actually resides. You need to use that full path in Node-RED because when you are running commands inside Node-RED, the command environment is completely different to the one you get when using a terminal.

thank you so much

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.