Execute Command in Kubernetes Pod
kube_pod_execExecute a command in a Kubernetes pod container via the API and capture stdout/stderr output.
Instructions
Execute a command in a container of a pod via the Kubernetes API (no kubectl). Captures stdout/stderr and returns them when the command completes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tty | No | Allocate a TTY (default false) | |
| args | No | Exact argv to execute without a shell, e.g., ["/bin/ls","-la"]. Provide this OR command. | |
| argv | No | Whitespace-separated argv to execute without a shell (e.g., "/usr/bin/env printenv"). Convenience for CLI; prefer args[] when possible. | |
| shell | No | Shell binary used when command is provided (default /bin/sh) | |
| stdin | No | Optional data to write to process stdin before closing it | |
| command | No | Shell command to run. Defaults to trying /bin/bash first, then /bin/sh, then other common shells. Provide this OR args[]. | |
| podName | Yes | Name of the target Pod | |
| container | No | Container name (optional; defaults to first container) | |
| namespace | No | Kubernetes namespace (defaults to "default") | |
| timeoutSeconds | No | Maximum time to wait for command completion (default 60s) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | ||
| stderr | Yes | ||
| stdout | Yes | ||
| command | No |