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 execution of commands inside containers of DaemonSets when using the "Exec" operation. It allows users to run arbitrary commands within pods managed by DaemonSets in a specified namespace.
Common scenarios include:
- Debugging or inspecting running containers in DaemonSets by executing shell commands.
- Running maintenance or diagnostic commands inside containers without redeploying.
- Automating operational tasks that require command execution inside Kubernetes pods.
For example, you might use this node to execute ls /var/log inside all pods of a DaemonSet to check log files or run a custom script for health checks.
Properties
| Name | Meaning |
|---|---|
| Image | The container image name used when running or restarting pods (relevant for some operations). |
| Namespace | The Kubernetes namespace where the DaemonSet and its pods reside. Defaults to "default". |
| Resource Name | The specific name of the DaemonSet resource to target. |
| Command | (Not listed in user properties but present in code) JSON array of strings representing the command to execute inside the pod. Required for "run" operation; for "exec", it is implied as the command to run inside the container. |
Note: Although your provided properties do not explicitly list "Command," the source code expects a JSON array command parameter for operations like "run" and "exec."
Output
The output is a JSON array containing the results of the executed command(s) inside the targeted pods. Each item includes:
stdout: The standard output returned from the command executed inside the pod's container.
If multiple pods are targeted, the output aggregates results from each pod, annotated with metadata linking back to the input item.
No binary data output is indicated by the code.
Dependencies
- Requires valid Kubernetes API credentials configured in n8n to authenticate and interact with the cluster.
- Uses an internal Kubernetes client utility (
K8SClient) to perform API calls. - The node depends on the Kubernetes cluster being accessible and the user having sufficient permissions to execute commands inside pods of DaemonSets.
Troubleshooting
Error: "No credentials got returned!"
This indicates missing or misconfigured Kubernetes API credentials. Ensure that the node has access to a valid API authentication token or key.Error: "Command must be an array!"
The command property must be a JSON array of strings. For example:["ls", "-l", "/"]. Passing a string or invalid JSON will cause this error.Permission Denied or Forbidden Errors
The Kubernetes service account or user may lack permissions to exec into pods. Verify RBAC settings and ensure the user can perform exec operations on pods in the specified namespace.Resource Not Found
If the specified DaemonSet or pod does not exist in the given namespace, the node will fail. Double-check resource names and namespaces.
Links and References
- Kubernetes Exec API: https://kubernetes.io/docs/tasks/debug-application-cluster/execute-command/
- Kubernetes Field Selectors: https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
- Kubernetes Label Selectors: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/