Run a one-shot command in a pod (synchronous, non-streaming)
POST
/pods/{podName}/exec
const url = 'https://example.com/pods/example/exec';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"command":["example"],"container":"example","namespace":"example","timeoutMs":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/pods/example/exec \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "command": [ "example" ], "container": "example", "namespace": "example", "timeoutMs": 1 }'Auth: authenticated (scope: exec)
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”podName
required
string
Request Body
Section titled “Request Body”Media typeapplication/json
object
command
required
Command to run; a string is wrapped as [‘/bin/sh’, ‘-c’, command]
Any of:
string
Array<string>
container
Container name (defaults to the first container in the pod spec)
string
namespace
Pod namespace; required here or as a ?namespace= query param
string
timeoutMs
Timeout in milliseconds, clamped to 1000..300000 (default 60000)
integer
key
additional properties
Example generated
{ "command": [ "example" ], "container": "example", "namespace": "example", "timeoutMs": 1}Responses
Section titled “Responses”OK
Media typeapplication/json
object
container
required
The container the command ran in
string
stderr
required
string
stdout
required
string
success
required
boolean
key
additional properties
Example generated
{ "container": "example", "stderr": "example", "stdout": "example", "success": true}