次の方法で共有


Managed Clusters - Run Command

マネージド クラスターに対して実行するコマンドを送信します。
AKS によって、コマンドを実行するポッドが作成されます。 これは主にプライベート クラスターに役立ちます。 詳細については、「 AKS Run Command」を参照してください。

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand?api-version=2024-02-01

URI パラメーター

名前 / 必須 説明
resourceGroupName
path True

string

リソース グループの名前。 名前の大文字と小文字は区別されます。

resourceName
path True

string

マネージド クラスター リソースの名前。

Regex pattern: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$

subscriptionId
path True

string

uuid

ターゲット サブスクリプションの ID。 値は UUID である必要があります。

api-version
query True

string

この操作に使用する API バージョン。

要求本文

名前 必須 説明
command True

string

実行するコマンド。

clusterToken

string

AKS AAD サーバー アプリ用に発行された AuthToken。

context

string

コマンドで必要なファイルを含む base64 でエンコードされた zip ファイル。

応答

名前 説明
200 OK

RunCommandResult

コマンドが非同期パターンで終了し、場所ヘッダーで追跡されました。 !!! これは自動設定専用です。この API から 200 を取得することはありません!!

202 Accepted

同意

Headers

Location: string

Other Status Codes

CloudError

操作に失敗した理由を説明するエラー応答。 クラスターが存在しない場合は、404 (見つかりません) が返されます。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名前 説明
user_impersonation ユーザー アカウントの借用

submitNewCommand

Sample Request

POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/runCommand?api-version=2024-02-01

{
  "command": "kubectl apply -f ns.yaml",
  "context": "",
  "clusterToken": ""
}

Sample Response

location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/clustername1/commandResults/0e9872e6629349dc865e27ee6f8bab2d?api-version=2024-02-01
{
  "id": "def7b3ea71bd4f7e9d226ddbc0f00ad9",
  "properties": {
    "provisioningState": "succeeded",
    "exitCode": 0,
    "startedAt": "2021-02-17T00:28:20Z",
    "finishedAt": "2021-02-17T00:28:33Z",
    "logs": "namespace dummy created"
  }
}

定義

名前 説明
CloudError

コンテナー サービスからのエラー応答。

CloudErrorBody

コンテナー サービスからのエラー応答。

RunCommandRequest

コマンドの実行要求

RunCommandResult

コマンドの結果を実行します。

CloudError

コンテナー サービスからのエラー応答。

名前 説明
error

CloudErrorBody

エラーの詳細。

CloudErrorBody

コンテナー サービスからのエラー応答。

名前 説明
code

string

エラーの識別子。 コードは不変であり、プログラムによって使用されることを意図しています。

details

CloudErrorBody[]

エラーに関するその他の詳細の一覧。

message

string

ユーザー インターフェイスでの表示に適したエラーを説明するメッセージ。

target

string

特定のエラーのターゲット。 たとえば、エラーが発生したプロパティの名前です。

RunCommandRequest

コマンドの実行要求

名前 説明
clusterToken

string

AKS AAD サーバー アプリ用に発行された AuthToken。

command

string

実行するコマンド。

context

string

コマンドで必要なファイルを含む base64 でエンコードされた zip ファイル。

RunCommandResult

コマンドの結果を実行します。

名前 説明
id

string

コマンド ID。

properties.exitCode

integer

コマンドの終了コード

properties.finishedAt

string

コマンドが完了した時刻。

properties.logs

string

コマンド出力。

properties.provisioningState

string

プロビジョニング状態

properties.reason

string

provisioningState が failed (失敗した場合) に設定されている理由の説明。

properties.startedAt

string

コマンドが開始された時刻。