Actions90
- Jobs Actions
- Namespaces Actions
- Pods Actions
- Services Actions
- Deployments Actions
- ReplicaSets Actions
- StatefulSets Actions
- DaemonSets Actions
- CronJobs Actions
Overview
This node enables interaction with Kubernetes clusters by performing various operations on Kubernetes resources. Specifically, for the Namespaces resource with the Run operation, it runs a pod in the specified namespace using a given container image and command, then returns the output of that pod's execution.
Common scenarios where this node is beneficial include:
- Running ad-hoc commands or scripts inside a Kubernetes cluster without manually creating pods.
- Automating tasks that require running containers dynamically within namespaces.
- Testing container images or commands in isolated namespaces programmatically.
For example, you might use this node to run a diagnostic script inside a namespace or execute a batch job by specifying the container image and command to run.
Properties
| Name | Meaning |
|---|---|
| Image | The container image to run inside the pod (e.g., nginx:latest, alpine). |
| Command | The command to execute inside the container, provided as a JSON array of strings (e.g., ["ls", "-la"]). Must be an array. |
| Namespace | The Kubernetes namespace where the pod will be run. Defaults to "default". |
| Resource Name | The name of the specific resource instance (not typically used for Run operation on Namespaces). |
Output
The node outputs JSON data containing the standard output (stdout) from the executed pod. This output represents the result of running the specified command inside the container image within the Kubernetes namespace.
If the command produces textual output, it will be included in the stdout field of the JSON output. There is no indication that binary data is returned for this operation.
Example output structure:
{
"stdout": "<command execution output as string>"
}
Dependencies
- Requires valid Kubernetes API credentials configured in n8n to authenticate and interact with the cluster.
- The node depends on a Kubernetes client utility internally to communicate with the Kubernetes API.
- The user must have appropriate permissions to create and run pods in the target namespace.
Troubleshooting
Error: "No credentials got returned!"
This indicates missing or misconfigured Kubernetes API credentials. Ensure that the node has access to valid credentials with sufficient permissions.Error: "Command must be an array!"
TheCommandproperty must be a JSON array of strings. Providing a non-array value will cause this error. Verify the command input format.Pod creation or execution failures
These may occur due to insufficient permissions, invalid image names, or namespace issues. Check Kubernetes cluster logs and permissions.Empty or no output
If the command does not produce output or the pod fails silently, verify the command correctness and container image functionality.