Skip to main content
POST
/
v1
/
clusters
/
{id}
/
exec
Execute command in pod
curl --request POST \
  --url https://api.cnap.tech/v1/clusters/{id}/exec \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "namespace": "default",
  "pod": "postgres-0",
  "container": "postgresql",
  "command": [
    "cat",
    "/etc/hostname"
  ]
}
'
{
  "stdout": "<string>",
  "stderr": "<string>",
  "exit_code": 123
}

Authorizations

Authorization
string
header
required

Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at https://cnap.tech/account/tokens

Path Parameters

id
string
required

Cluster ID

Body

application/json
namespace
string
required

Kubernetes namespace

Required string length: 1 - 253
Example:

"default"

pod
string
required

Pod name

Required string length: 1 - 253
Example:

"postgres-0"

container
string
required

Container name within the pod

Required string length: 1 - 253
Example:

"postgresql"

command
string[]
required

Command and arguments

Minimum array length: 1
Example:
["cat", "/etc/hostname"]

Response

Command result

stdout
string
required

Standard output

stderr
string
required

Standard error

exit_code
integer
required

Exit code (0 = success)