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 resources, specifically supporting the "Run" operation on StatefulSets (and other resource types). The "Run" operation allows you to execute a container image with a specified command inside a Kubernetes pod within a given namespace. This is useful for running ad-hoc jobs, scripts, or commands in your Kubernetes cluster without manually creating pod manifests.
Common scenarios include:
- Running a one-off task or script inside a Kubernetes environment.
- Executing diagnostic or maintenance commands using a specific container image.
- Automating deployment or operational workflows that require running containers dynamically.
For example, you might run a database migration script by specifying the appropriate image and command, targeting the namespace where your StatefulSet resides.
Properties
| Name | Meaning |
|---|---|
| Image | The container image to run inside the pod (e.g., busybox, alpine, or a custom image). |
| Command | The command to execute inside the container, provided as a JSON array of strings (e.g., ["sh", "-c", "echo Hello"]). Must be an array. |
| Namespace | The Kubernetes namespace where the pod will be run. Defaults to "default". |
| Resource Name | The name of the StatefulSet resource (or other resource) related to the operation. |
Output
The output is a JSON array containing the result of running the pod with the specified image and command. The main field is:
stdout: A string containing the standard output from the executed command inside the pod.
This output allows you to capture and use the command's result in subsequent workflow steps.
No binary data output is produced by this operation.
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 permissions to create pods and run commands in the target namespace.
Troubleshooting
Error: "No credentials got returned!"
This indicates missing or invalid Kubernetes API credentials. Ensure you have properly configured and selected the required API authentication token or key in n8n credentials.Error: "Command must be an array!"
TheCommandproperty must be a valid JSON array of strings. Check that the input is correctly formatted JSON representing an array, e.g.,["ls", "-l"].Permission Denied or Forbidden Errors
If the Kubernetes API returns permission errors, verify that the credentials used have sufficient RBAC permissions to create pods and execute commands in the specified namespace.Pod Creation Failures
Issues such as invalid image names or network problems can cause pod creation to fail. Confirm the image exists and is accessible from the cluster.