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
}Runs a command in a pod container and returns stdout, stderr, and exit code. Non-interactive (no TTY, no stdin). Timeout: 30 seconds.
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
}Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at https://cnap.tech/account/tokens
Cluster ID
Kubernetes namespace
1 - 253"default"
Pod name
1 - 253"postgres-0"
Container name within the pod
1 - 253"postgresql"
Command and arguments
1["cat", "/etc/hostname"]