Skip to main content

Run one command in a container

POST 

/api/namespaces/:namespace/pods/:name/exec

Permission: pods:exec in the namespace of the path (permissions).

command is an argv array and is not run in a shell (for pipes, pass ["sh", "-c", "…"]). No stdin. Output is kept up to 1 MiB per stream; the rest is dropped and truncated is true, but the command runs to its end. timeoutSeconds 1–120 (default 30): past it the output so far comes back with exitCode: -1 and truncated: true (Kubernetes does not stop the process; it may run on in the container). A non-zero exit code is a normal answer (200). Output is text: bytes that are not UTF-8 come back as U+FFFD, so pipe binary output through base64. Recorded like a shell (Admin → Recordings, "command"); the audit log keeps the program name (command[0]), never the whole command line.

Request​

Responses​

The command ran (whatever its exit code).