華為云計算 云知識 進入容器執(zhí)行命令connectCoreV1PostNamespacedPodExec
進入容器執(zhí)行命令connectCoreV1PostNamespacedPodExec

 

功能介紹

進入容器執(zhí)行命令。

調(diào)用方法

請參見如何調(diào)用API。

URI

POST /api/v1/namespaces/{namespace}/pods/{name}/exec

表1 路徑參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

name

String

name of the PodExecOptions

namespace

String

object name and auth scope, such as for teams and projects

表2 Query參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

command

String

Command is the remote command to execute. argv array. Not executed within a shell.

container

String

Container in which to execute the command. Defaults to only container if there is only one container in the pod.

stderr

Boolean

Redirect the standard error stream of the pod for this call. Defaults to true.

stdin

Boolean

Redirect the standard input stream of the pod for this call. Defaults to false.

stdout

Boolean

Redirect the standard output stream of the pod for this call. Defaults to true.

tty

Boolean

TTY if true indicates that a tty will be allocated for the exec call. Defaults to false.

請求參數(shù)

表3 請求Header參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

X-Auth-Token

String

用戶Token。

通過調(diào)用 IAM 服務獲取用戶Token接口獲取(響應消息頭中X-Subject-Token的值)。

Content-Type

String

消息體的類型(格式),默認取值為“application/json”

缺省值:application/json

響應參數(shù)

請求示例

響應示例

狀態(tài)碼

狀態(tài)碼

描述

200

OK

400

BadRequest

401

Unauthorized

403

Forbidden

404

NotFound

405

MethodNotAllowed

406

NotAcceptable

409

AlreadyExists

415

UnsupportedMediaType

422

Invalid

429

TooManyRequests

500

InternalError

503

ServiceUnavailable

504

ServerTimeout