Actions40
- Node Actions
- Namespace Actions
- Deployment Actions
- Service Actions
- Pod Actions
- StatefulSet Actions
- ConfigMap Actions
- Secret Actions
- Job Actions
- CronJob Actions
Overview
The node provides an interface to interact with Rancher/Kubernetes API resources, specifically here focusing on the Pod resource with the Exec operation. This operation allows users to execute a command inside a specific container of a Kubernetes pod.
This is useful in scenarios where you need to run diagnostic commands, scripts, or any arbitrary shell commands inside a running pod without needing to SSH into the underlying node or modify the pod's configuration. For example, you might want to check the status of an application, inspect logs, or perform maintenance tasks directly inside the container.
Practical examples:
- Running
lsorcat /var/log/app.loginside a pod to inspect files. - Executing database client commands inside a pod hosting a database container.
- Triggering application-specific commands/scripts for debugging or configuration.
Properties
| Name | Meaning |
|---|---|
| Cluster Name or ID | Select the Kubernetes cluster to target. Choose from a list or specify an ID via expression. |
| Project Name or ID | Select the project within the cluster. Depends on the selected cluster. |
| Namespace Name or ID | Select the namespace within the project. Depends on the selected project. |
| Pod ID | The identifier of the pod where the command will be executed. |
| Command | The command string to execute inside the pod's container. |
| Container | (Optional) The name of the container inside the pod to execute the command in. If not specified, the first container is used. |
Output
The output of this operation is a JSON object containing the result of the executed command inside the pod. The exact structure depends on the response from the Rancher/Kubernetes API but generally includes:
- The standard output and/or error output of the command execution.
- Status information about the execution.
No binary data output is indicated for this operation.
Dependencies
- Requires access to a Rancher/Kubernetes API endpoint.
- Requires an API authentication token or key configured as credentials in n8n to authorize requests.
- The node depends on the Rancher/Kubernetes environment having the necessary permissions to execute commands inside pods.
Troubleshooting
Common issues:
- Incorrect pod ID or container name may cause the command execution to fail.
- Insufficient permissions or RBAC restrictions can prevent executing commands inside pods.
- Network connectivity issues to the Kubernetes cluster or Rancher API can cause timeouts or failures.
- Specifying a command that does not exist or is invalid inside the container will return an error.
Error messages and resolutions:
- "Pod not found" — Verify the pod ID and namespace are correct.
- "Container not found" — Check if the container name is correct or omit it to use the default container.
- "Permission denied" — Ensure the API credentials have exec permissions on pods.
- Timeout errors — Check network connectivity and cluster health.
Links and References
- Kubernetes Exec API Documentation
- Rancher API Reference
- n8n Expressions Documentation (for dynamic property values)