容器服务Kubernetes版(cs) CLI 命令参考

更新时间:
复制 MD 格式

本文列出容器服务Kubernetes版(cs)在阿里云 CLI 中的可用命令,并提供各命令的语法和参数说明。

前提条件

  • 已安装阿里云 CLI。安装方法请参见安装/更新 CLI。

  • 执行需要身份认证的命令前,请确认已配置阿里云 CLI 凭证,且凭证对应的身份拥有所需权限。配置方法请参见配置与管理身份凭证。

地域与接入点

凭证配置中的默认地域可用 --region <regionId> 覆盖。

未指定接入地址时,CLI 按产品规则尝试解析,需要指定时可按地域和网络类型查看 Endpoint,再使用 --endpoint <endpoint>。

版本信息

属性

值

CLI 版本

3.5.3

API 版本

2015-12-15

可用命令

单击命令名称,查看命令描述、语法和参数说明。

命令详情

语法逐行列出命令参数:<类型> 是需要替换的值占位符,方括号表示可选参数,# 表示列表项序号;[options] 表示 CLI 通用选项,见“全局选项”。可选对象或列表内标为必填的字段,仅在提供该对象或列表项时必填。完整参数定义见各命令的参数说明。

AttachInstances

命令描述

如果购买ECS实例后需要将该云服务器添加到ACK集群中作为Worker节点,或移除Worker节点后需将节点实例重新加入节点池,您可以调用AttachInstances接口,将已有ECS实例添加到ACK集群

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/attach

语法

aliyun cs AttachInstances
    --ClusterId <string>
    [--body <object>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

Object

否

请求体参数

示例

aliyun cs POST /clusters/c106f377e16f34eb1808d6b9362c90000/attach --region cn-hangzhou --header "Content-Type=application/json" --body '{"instances":["i-2zed0sswuau6o89b****"]}'

AttachInstancesToNodePool

命令描述

如果需要将已有ECS实例添加到ACK集群中作为Worker节点,或移除Worker节点后需将节点实例重新加入节点池,您可以调用AttachInstancesToNodePool将已有节点添加到节点池

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodepools/{NodepoolId}/attach

语法

aliyun cs AttachInstancesToNodePool
    --ClusterId <string>
    --NodepoolId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--body

String

否

请求体参数

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/nodepools/np31da1b38983f4511b490fc62108a0000/attach --region cn-hangzhou --header "Content-Type=application/json"

CancelClusterUpgrade

命令描述

取消处于升级状态的ACK集群

已弃用:true

HTTP 方法:POST

protocol:HTTPS

url:/api/v2/clusters/{ClusterId}/upgrade/cancel

语法

aliyun cs CancelClusterUpgrade
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs POST /api/v2/clusters/c106f377e16f34eb1808d6b9362c90000/upgrade/cancel --region cn-hangzhou --header "Content-Type=application/json"

CancelComponentUpgrade

命令描述

取消集群组件升级

已弃用:true

HTTP 方法:POST

protocol:HTTPS

url:/clusters/{clusterId}/components/{componentId}/cancel

语法

aliyun cs CancelComponentUpgrade
    --clusterId <string>
    --componentId <string>
    [options]

参数

参数

类型

必填

说明

--clusterId

String

是

集群ID

--componentId

String

是

组件ID

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/components/metric-server/cancel --region cn-hangzhou --header "Content-Type=application/json"

CancelOperationPlan

命令描述

使用CancelOperationPlan取消已存在但未执行的自动运维任务执行计划

HTTP 方法:DELETE

protocol:HTTPS

url:/operation/plans/{plan_id}

语法

aliyun cs CancelOperationPlan
    [--plan_id <string>]
    [options]

参数

参数

类型

必填

说明

--plan_id

String

否

执行计划ID

示例

aliyun cs DELETE /operation/plans/P-655c9c127e0e6603ef000000 --region cn-hangzhou --header "Content-Type=application/json"

CancelTask

命令描述

您可以调用CancelTask接口,取消集群任务的执行

HTTP 方法:POST

protocol:HTTPS

url:/tasks/{task_id}/cancel

语法

aliyun cs CancelTask
    --task_id <string>
    [options]

参数

参数

类型

必填

说明

--task_id

String

是

任务ID

示例

aliyun cs POST /tasks/T-62ccd14aacb8db06ca000000/cancel --region cn-hangzhou --header "Content-Type=application/json"

CheckControlPlaneLogEnable

命令描述

ACK托管集群支持收集控制面组件日志并投递到您的SLS Log Project中。控制面组件包括Kube API Server、Kube Scheduler、Kube Controller Manager、Cloud Controller Manager等核心组件。您可以调用CheckControlPlaneLogEnable接口,查询控制面组件当前的日志配置,包括日志保存时间、采集的组件等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/controlplanelog

语法

aliyun cs CheckControlPlaneLogEnable
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs GET /clusters/c5b5e80b0b64a4bf6939d2d8fbbc50000/controlplanelog --region cn-hangzhou --header "Content-Type=application/json"

CheckServiceRole

命令描述

检查当前服务账号是否已授予指定的服务角色权限。只有授予对应的角色权限后,容器服务才能正常调用服务角色相关的其他云服务(ECS、OSS、NAS、SLB等)

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/ram/check-service-role

语法

aliyun cs CheckServiceRole
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

示例

aliyun cs POST /ram/check-service-role --region cn-hangzhou --header "Content-Type=application/json" --body '{"roles":[{"name":"AliyunCSManagedAutoScalerRole"}]}'

CleanClusterUserPermissions

命令描述

如果您想针对部分有安全风险的KubeConfig进行清理和解除授权,您可以调用CleanClusterUserPermissions清理指定用户在指定集群已下发的KubeConfig凭据和RBAC权限

HTTP 方法:DELETE

protocol:HTTPS

url:/cluster/{ClusterId}/user/{Uid}/permissions

语法

aliyun cs CleanClusterUserPermissions
    --ClusterId <string>
    [--Force <bool>]
    --Uid <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--Force

Boolean

否

是否强制删除指定的KubeConfig,取值:
false(默认值):删除KubeConfig前校验是否在七天内存在相关的集群访问记录,如果存在或无法查找集群访问记录,则不允许删除。
true:强制删除KubeConfig,不检查集群访问记录

--Uid

String

是

阿里云账号内指定RAM用户或RAM角色ID

示例

aliyun cs DELETE /cluster/c5b5e80b0b64a4bf6939d2d8fbbc50000/user/2xxxxxxxxxxxxxxxxxx/permissions --region cn-hangzhou --header "Content-Type=application/json"

CleanUserPermissions

命令描述

如果您想针对部分风险用户(已离职、账号冻结等)的KubeConfig进行清理并解除授权,您可以调用CleanUserPermissions清理指定用户已下发的KubeConfig凭据和RBAC权限

HTTP 方法:DELETE

protocol:HTTPS

url:/users/{Uid}/permissions

语法

aliyun cs CleanUserPermissions
    [--ClusterIds <array>]
    [--Force <bool>]
    --Uid <string>
    [options]

参数

参数

类型

必填

说明

--ClusterIds

List

否

集群ID列表。如指定了该列表,则仅清除当前用户在列表内集群的KubeConfig和RBAC权限

--Force

Boolean

否

是否强制删除指定的KubeConfig,取值:
false(默认值):删除KubeConfig前校验是否在七天内存在相关的集群访问记录,如果存在或无法查找集群访问记录,则不允许删除。
true:强制删除KubeConfig,不检查集群访问记录

--Uid

String

是

阿里云账号内指定RAM用户或RAM角色ID

示例

aliyun cs DELETE /users/265624438516500000/permissions --region cn-hangzhou --header "Content-Type=application/json"

CreateAutoRepairPolicy

命令描述

创建自愈规则

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/auto_repair_policies

语法

aliyun cs CreateAutoRepairPolicy
    [--body <string>]
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求参数

--cluster_id

String

否

集群ID

示例

aliyun cs POST /clusters/cb95aa626a47740afbf6aa099b6500000/auto_repair_policies --region cn-hangzhou --header "Content-Type=application/json" --body '{"name":"test","resource_type":"nodepool","rules":[{"repair_procedure":[{"name":"Drain","intervention":{"enable":true,"inquiring_label":{"value":"inquiring","key":"k8s.aliyun.com/incident"},"type":"label","approved_label":{"value":"approved","key":"k8s.aliyun.com/incident"}},"config":{"key":"{\n\"drain_timeout\": \"30s\" \n}"}}],"incidents":[{"name":"Node.FaultNeedReboot.HOST","type":"system"}]}],"resource_sub_type":"ess"}'

CreateAutoscalingConfig

命令描述

您可以创建自动弹性伸缩配置,让系统能够按照配置的伸缩规则自动增加或减少计算资源,满足您的集群工作负载的需求。创建过程中,您可以指定扩缩容的度量指标和阈值、扩容顺序、静默时间等

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/cluster/{ClusterId}/autoscale/config/

语法

aliyun cs CreateAutoscalingConfig
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs POST /cluster/cdde1f21ae22e483ebcb068a6eb7f0000/autoscale/config/ --region cn-hangzhou --header "Content-Type=application/json"

CreateCluster

命令描述

您可以通过OpenAPI创建ACK集群,包含ACK托管集群、ACK Serverless集群,ACK Edge集群以及注册集群。创建集群时,您将完成集群信息、集群组件以及ACK相关云资源的配置

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters

语法

aliyun cs CreateCluster
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

示例

aliyun cs POST /clusters --region cn-hangzhou --header "Content-Type=application/json" --body '{"name":"cluster-demo","region_id":"cn-beijing"}'

CreateClusterDiagnosis

命令描述

发起集群诊断

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/diagnosis

语法

aliyun cs CreateClusterDiagnosis
    [--body <string>]
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--cluster_id

String

否

集群ID

示例

aliyun cs POST /clusters/ce0da5a1d627e4e9e9f96cae8ad070000/diagnosis --region cn-hangzhou --header "Content-Type=application/json" --body '{"type":"node","target":{"namespace":"kube-system","name":"csi-plugin-2cg9f"}}'

CreateClusterInspectConfig

命令描述

创建集群巡检配置

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterId}/inspectConfig

语法

aliyun cs CreateClusterInspectConfig
    [--body <string>]
    --clusterId <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求结构体

--clusterId

String

是

集群ID

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/inspectConfig --region cn-hangzhou --header "Content-Type=application/json" --body '{"recurrence":"FREQ=DAILY;BYHOUR=10;BYMINUTE=15","enabled":true}'

CreateClusterNodePool

命令描述

节点池是具有相同属性的一组节点的逻辑集合,允许对节点进行统一的管理和运维,例如节点升级、弹性伸缩等。您可以进一步使用节点池的自动化运维能力,使用OS CVE漏洞自动修复、故障节点自动恢复、kubelet和containerd版本自动升级等功能,降低运维成本。您可以调用CreateClusterNodePool为集群创建节点池

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodepools

语法

aliyun cs CreateClusterNodePool
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs POST /clusters/c61da77e8bfbc4c4c999af2b51b650000/nodepools --region cn-hangzhou --header "Content-Type=application/json"

CreateKubernetesTrigger

命令描述

为应用创建触发器

已弃用:true

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/triggers

语法

aliyun cs CreateKubernetesTrigger
    [--body <object>]
    [options]

参数

参数

类型

必填

说明

--body

Object

否

请求体参数

示例

aliyun cs POST /triggers --region cn-hangzhou --header "Content-Type=application/json" --body '{"cluster_id":"c5cdf7e3938bc4f8eb0e44b21a80f****","project_id":"default/test-app","action":"redeploy"}'

CreateNodePoolComponentInstances

命令描述

安装节点组件

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/component_instances

语法

aliyun cs CreateNodePoolComponentInstances
    [--body <string>]
    --cluster_id <string>
    --nodepool_id <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--cluster_id

String

是

集群ID

--nodepool_id

String

是

节点池ID

示例

aliyun cs POST /clusters/c2230fxxxxx/nodepools/np8d8c9c2cd0f64e89884f82a5fbcd0000/component_instances --region cn-hangzhou --header "Content-Type=application/json" --body '{"components":[{"name":"kubelet","version":"1.33.3-aliyun.1"}]}'

CreateTemplate

命令描述

编排模板是对一组Kubernetes集群资源的定义和描述,以声明性方式描述应用应该如何运行或者配置。您可以基于这些模板自动化部署和管理集群中的资源,例如Pods、Services、Deployments、ConfigMaps、PersistentVolumes等。您可以调用CreateTemplate接口创建一个编排模板

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/templates

语法

aliyun cs CreateTemplate
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

示例

aliyun cs POST /templates --region cn-hangzhou --header "Content-Type=application/json" --body '{"template":"apiVersion: v1\\nkind: ServiceAccount\\nmetadata:\\n  name: test-sa","name":"service-account-template"}'

CreateTrigger

命令描述

您可以为集群应用配置触发器的功能,指定触发器在接收到某些条件时重新部署Pod

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/triggers

语法

aliyun cs CreateTrigger
    [--body <object>]
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--body

Object

否

请求体参数

--cluster_id

String

是

集群ID

示例

aliyun cs POST /clusters/c68deb844dc6d480eb775be611fdf0000/triggers --region cn-hangzhou --header "Content-Type=application/json" --body '{"cluster_id":"c5cdf7e3938bc4f8eb0e44b21a80f****","project_id":"default/test-app","action":"redeploy"}'

DeleteAlertContact

命令描述

删除ACK报警联系人

HTTP 方法:DELETE

protocol:HTTPS

url:/alert/contacts

语法

aliyun cs DeleteAlertContact
    --contact_ids <array>
    [options]

参数

参数

类型

必填

说明

--contact_ids

List

是

报警联系人的 ID 列表

示例

aliyun cs DELETE /alert/contacts --region cn-hangzhou --contact_ids '[12345]' --header "Content-Type=application/json"

DeleteAlertContactGroup

命令描述

删除ACK报警联系人分组

HTTP 方法:DELETE

protocol:HTTPS

url:/alert/contact_groups

语法

aliyun cs DeleteAlertContactGroup
    --contact_group_ids <array>
    [options]

参数

参数

类型

必填

说明

--contact_group_ids

List

是

报警联系人分组 ID 列表

示例

aliyun cs DELETE /alert/contact_groups --region cn-hangzhou --contact_group_ids '[12345]' --header "Content-Type=application/json"

DeleteAutoRepairPolicy

命令描述

删除自愈规则

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{cluster_id}/auto_repair_policies/{policy_id}

语法

aliyun cs DeleteAutoRepairPolicy
    [--cluster_id <string>]
    [--policy_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--policy_id

String

否

自愈规则ID

示例

aliyun cs DELETE /clusters/c104d5d5f301c4e2a8ee578c37000000/auto_repair_policies/r-xxxxxx --region cn-hangzhou --header "Content-Type=application/json"

DeleteCluster

命令描述

如果您的集群无需使用,请删除集群并选择是否删除或保留集群的相关资源。删除集群前,请手动清理工作负载(无状态、有状态、任务和定时任务),否则可能导致集群删除失败

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{ClusterId}

语法

aliyun cs DeleteCluster
    --ClusterId <string>
    [--delete_options <array>]
    [--keep_slb <bool>]
    [--retain_all_resources <bool>]
    [--retain_resources <array>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--delete_options

List

否

集群关联资源的删除选项

--keep_slb

Boolean

否

是否保留SLB,取值:
true:保留创建的SLB资源。
false:不保留创建的SLB资源。
默认值:false。
请使用delete_options中的SLB管理



--retain_all_resources

Boolean

否

是否保留所有资源。如果设置该值为true,则会忽略retain_resources,通过DescribeClusterResources接口查询到的通过集群创建的云资源将被保留。如果该值为false,请注意delete_options中默认保留的资源仍将被保留,如需删除相关资源,请单独在delete_options中设置delete_mode为delete。
true:保留所有资源,包含所有通过集群创建的云资源。
false:不保留所有资源(delete_options中定义的默认保留资源除外,如ALB在该参数取值为false时仍然保留)。
默认值:false


--retain_resources

List

否

资源列表。删除集群时如果需要保留资源,则需要提供对应资源的ID

示例

aliyun cs DELETE /clusters/c905d1364c2dd4b6284a3f41790c40000 --region cn-hangzhou --header "Content-Type=application/json"

DeleteClusterInspectConfig

命令描述

删除集群巡检配置

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{clusterId}/inspectConfig

语法

aliyun cs DeleteClusterInspectConfig
    --clusterId <string>
    [options]

参数

参数

类型

必填

说明

--clusterId

String

是

集群ID

示例

aliyun cs DELETE /clusters/c82e6987e2961451182edacd74faf0000/inspectConfig --region cn-hangzhou --header "Content-Type=application/json"

DeleteClusterNodepool

命令描述

您可以调用DeleteClusterNodepool接口删除不再使用的节点池。节点池删除时所有节点上的Pod将会被删除,并可能触发重调度,如无法调度可能影响业务,请确保集群有足够的资源进行重调度

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{ClusterId}/nodepools/{NodepoolId}

语法

aliyun cs DeleteClusterNodepool
    --ClusterId <string>
    --NodepoolId <string>
    [--force <bool>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--force

Boolean

否

是否强制删除。
true:强制删除。节点池中有存量节点时,会强制删除已有的节点。
false:不强制删除。节点池中有存量节点时,禁止删除节点池,接口调用会返回报错。
删除节点池不会自动释放包年包月的节点。如需释放包年包月的节点,请参见包年包月转按量付费将包年包月的节点转换为按量付费的节点 (https://help.aliyun.com/zh/ecs/change-the-billing-method-of-an-instance-from-subscription-to-pay-as-you-go-1?spm=a2c4g.11174283.help-menu-search-25365.d_3),再登录ECS管理控制台完成释放


示例

aliyun cs DELETE /clusters/c61da77e8bfbc4c4c999af2b51b650000/nodepools/np30db56bcac7843dca90b999c89280000 --region cn-hangzhou --header "Content-Type=application/json"

DeleteClusterNodes

命令描述

当您不再需要集群节点继续工作时,可以调用DeleteClusterNodes接口将集群中的节点移出集群。移除节点时,您可以选择是否同时释放ECS、是否自动排空节点

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodes

语法

aliyun cs DeleteClusterNodes
    --ClusterId <string>
    [--body <object>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

Object

否

请求体参数

示例

aliyun cs POST /clusters/c850429a2287b4d968e27e87a49210000/nodes --region cn-hangzhou --header "Content-Type=application/json" --body '{"nodes":["cn-hangzhou.192.168.xx.xx"]}'

DeleteKubernetesTrigger

命令描述

根据应用触发器ID,删除应用触发器

已弃用:true

HTTP 方法:DELETE

protocol:HTTPS

url:/triggers/revoke/{Id}

语法

aliyun cs DeleteKubernetesTrigger
    --Id <string>
    [options]

参数

参数

类型

必填

说明

--Id

String

是

触发器ID

示例

aliyun cs DELETE /triggers/revoke/c5cdf7e3938bc4f8eb0e44b21a80f0000 --region cn-hangzhou --header "Content-Type=application/json"

DeleteNodePoolComponentInstance

命令描述

卸载节点组件

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/component_instances/{name}

语法

aliyun cs DeleteNodePoolComponentInstance
    [--batch_interval <int>]
    --cluster_id <string>
    [--max_failed_nodes <int>]
    [--max_parallelism <int>]
    --name <string>
    [--node_names <array>]
    --nodepool_id <string>
    [--pause_policy <string>]
    [options]

参数

参数

类型

必填

说明

--batch_interval

Integer

否

批次之间的间隔时间,单位秒,默认0

--cluster_id

String

是

集群ID

--max_failed_nodes

Integer

否

允许滚动过程中失败的最大节点数。默认为0,即任一节点失败即判定任务失败;大于0时,累计失败节点数超过该值则整体判定失败并停止

--max_parallelism

Integer

否

每批次的最大并行数,默认值1

--name

String

是

组件名称

--node_names

List

否

指定轮转的节点列表,默认为全部节点

--nodepool_id

String

是

节点池ID

--pause_policy

String

否

节点升级过程中的自动暂停策略。
NotPause
FirstBatch
EveryBatch
默认策略NotPause



示例

aliyun cs DELETE /clusters/c846d7d529e34413c9ab10000/nodepools/np1855b102ac434f5990d87b77a0000/component_instances/component-name --region cn-hangzhou --header "Content-Type=application/json"

DeletePolicyInstance

命令描述

您可以调用DeletePolicyInstance接口,在指定集群中删除策略规则实例

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{cluster_id}/policies/{policy_name}

语法

aliyun cs DeletePolicyInstance
    --cluster_id <string>
    [--instance_name <string>]
    --policy_name <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

目标集群ID

--instance_name

String

否

策略规则实例ID

--policy_name

String

是

策略治理规则名称

示例

aliyun cs DELETE /clusters/c8155823d057948c69a0000/policies/ACKAllowedRepos --region cn-hangzhou --header "Content-Type=application/json"

DeleteTemplate

命令描述

当您无需使用某些编排模板时,您可以调用DeleteTemplate接口删除编排模板

HTTP 方法:DELETE

protocol:HTTPS

url:/templates/{TemplateId}

语法

aliyun cs DeleteTemplate
    --TemplateId <string>
    [options]

参数

参数

类型

必填

说明

--TemplateId

String

是

编排模板ID

示例

aliyun cs DELETE /templates/20663627-81ee-4cfe-9b69-c96fcb000000 --region cn-hangzhou --header "Content-Type=application/json"

DeleteTrigger

命令描述

当您不再需要触发器时,可以调用DeleteTrigger删除应用触发器

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{cluster_id}/triggers/{Id}

语法

aliyun cs DeleteTrigger
    --Id <string>
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--Id

String

是

触发器ID

--cluster_id

String

是

集群ID

示例

aliyun cs DELETE /clusters/c68deb844dc6d480eb775be611f000000/triggers/759734974868000000 --region cn-hangzhou --header "Content-Type=application/json"

DeployPolicyInstance

命令描述

您可以在ACK集群中选择安全策略类型,配置策略实例的治理动作(告警或拦截)、作用的命名空间范围等,以创建并部署一个策略实例。您可以调用DeployPolicyInstance接口,在指定集群的命名空间中部署策略规则实例

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/policies/{policy_name}

语法

aliyun cs DeployPolicyInstance
    [--body <object>]
    --cluster_id <string>
    --policy_name <string>
    [options]

参数

参数

类型

必填

说明

--body

Object

否

请求结构

--cluster_id

String

是

目标集群ID

--policy_name

String

是

策略治理规则名称

示例

aliyun cs POST /clusters/c8155823d057948c69a0000/policies/ACKAllowedRepos --region cn-hangzhou --header "Content-Type=application/json"

DescribeAddon

命令描述

您可以调用DescribeAddon接口,根据指定地域、集群类型、集群子类型(profile)、集群版本、组件名称等参数查询目标组件的信息,包括组件托管与否、组件分类、支持的自定义参数Schema、兼容的操作系统架构、该版本要求的最低集群版本等

HTTP 方法:GET

protocol:HTTPS

url:/addons/{addon_name}

语法

aliyun cs DescribeAddon
    [--addon_name <string>]
    [--cluster_id <string>]
    [--cluster_spec <string>]
    [--cluster_type <string>]
    [--cluster_version <string>]
    [--profile <string>]
    [--region_id <string>]
    [--version <string>]
    [options]

参数

参数

类型

必填

说明

--addon_name

String

否

组件名称

--cluster_id

String

否

集群ID。
指定集群ID时,查询该集群可用的组件列表,此时其他参数将会被忽略

--cluster_spec

String

否

集群规格。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--cluster_type

String

否

集群类型。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--cluster_version

String

否

集群版本。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--profile

String

否

集群子类型。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--region_id

String

否

地域。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--version

String

否

组件版本。不指定时,查询该组件可用的最新版本

示例

aliyun cs GET /addons/coredns --region cn-hangzhou --cluster_version '1.26.3-aliyun.1' --cluster_id 'c02b3e03be10643e8a644a843ffcb****' --cluster_spec 'ack.pro.small' --region_id 'cn-hangzhou' --cluster_type ManagedKubernetes --header "Content-Type=application/json"

DescribeAddons

命令描述

查询平台支持的所有组件的详情

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters/components/metadata

语法

aliyun cs DescribeAddons
    [--cluster_profile <string>]
    [--cluster_spec <string>]
    [--cluster_type <string>]
    [--cluster_version <string>]
    --region <string>
    [options]

参数

参数

类型

必填

说明

--cluster_profile

String

否

集群类型,取值:
Default:托管版集群。
Serverless:Serverless集群。
Edge:边缘集群


--cluster_spec

String

否

当您选择cluster_type为ManagedKubernetes并配置profile后,您可以进一步指定集群的规格。
ack.pro.small:集群Pro版。
ack.standard:集群基础版(取值为空时默认选择)

--cluster_type

String

否

Kubernetes: ACK专有集群。
ManagedKubernetes:ACK托管类的集群,包括ACK托管集群(ACK集群Pro版、ACK集群基础版)、ACK Serverless集群(Pro版、基础版)、ACK Edge集群(Pro版、基础版)、ACK灵骏集群(Pro版)。
ExternalKubernetes:注册集群

--cluster_version

String

否

集群版本

--region

String

是

集群所在地域ID

示例

aliyun cs GET /clusters/components/metadata --header "Content-Type=application/json" --region 'cn-hangzhou'

DescribeAutoRepairPolicy

命令描述

查询自愈规则

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/auto_repair_policies/{policy_id}

语法

aliyun cs DescribeAutoRepairPolicy
    [--cluster_id <string>]
    [--policy_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--policy_id

String

否

自愈规则ID

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/auto_repair_policies/r-xxxxxx --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterAddonInstance

命令描述

调用DescribeClusterAddonInstance查询已安装的集群组件的版本、状态和配置等信息

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterID}/components/{AddonName}/instance

语法

aliyun cs DescribeClusterAddonInstance
    --AddonName <string>
    --ClusterID <string>
    [options]

参数

参数

类型

必填

说明

--AddonName

String

是

组件名称

--ClusterID

String

是

集群ID

示例

aliyun cs GET /clusters/cd06bbf8a86764a31bcac761366910000/components/terway-eniip/instance --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterAddonMetadata

命令描述

调用DescribeClusterAddonMetadata查询特定集群可使用的指定组件版本信息,包括组件版本、可配置参数等

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/components/{component_id}/metadata

语法

aliyun cs DescribeClusterAddonMetadata
    --cluster_id <string>
    --component_id <string>
    [--version <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

集群ID

--component_id

String

是

组件ID

--version

String

否

组件版本

示例

aliyun cs GET /clusters/c71d616e629ff40d5b42d7bb877700000/components/coredns/metadata --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterAddonUpgradeStatus

命令描述

调用DescribeClusterAddonUpgradeStatus查询集群组件升级状态

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/components/{ComponentId}/upgradestatus

语法

aliyun cs DescribeClusterAddonUpgradeStatus
    --ClusterId <string>
    --ComponentId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--ComponentId

String

是

组件ID,例如:nginx-ingress-controller、flexvolume、metrics-server。
集群支持的组件,可通过API DescribeAddons 进行查询

示例

aliyun cs GET /clusters/c106f377e16f34eb1808d6b9362c90000/components/cloud-controller-manager/upgradestatus --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterAddonsUpgradeStatus

命令描述

根据组件名称查询该组件升级状态

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/components/upgradestatus

语法

aliyun cs DescribeClusterAddonsUpgradeStatus
    --ClusterId <string>
    --componentIds <array>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--componentIds

List

是

组件名称列表

示例

aliyun cs GET /clusters/c23421cfa74454bc8b37163fd19af0000/components/upgradestatus --region cn-hangzhou --componentIds '["metric-server"]' --header "Content-Type=application/json"

DescribeClusterAddonsVersion

命令描述

根据集群ID,查询集群中已安装的所有组件的详情

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/components/version

语法

aliyun cs DescribeClusterAddonsVersion
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/components/version --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterAttachScripts

命令描述

如果需要将已有ECS实例添加到ACK集群中作为Worker节点,或移除Worker节点后需将节点实例重新加入节点池,ACK支持手动将已有节点到节点池。您可以调用DescribeClusterAttachScripts接口获取添加已有节点的脚本

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/attachscript

语法

aliyun cs DescribeClusterAttachScripts
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs POST /clusters/ca375a93a30474552ad2a0ebe183e0000/attachscript --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterDetail

命令描述

您可以调用DescribeClusterDetail接口,根据集群ID查询指定集群的详细信息

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}

语法

aliyun cs DescribeClusterDetail
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs GET /clusters/cdde1f21ae22e483ebcb068a6eb7f0000 --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterEvents

命令描述

集群操作事件包括集群创建、集群变更、节点池创建、节点池扩容、Addon安装、集群升级等。您可以调用DescribeClusterEvents接口,获取指定集群中发生的事件列表,并查询事件的详细信息,包括事件级别、时间状态、时间发生时间等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/events

语法

aliyun cs DescribeClusterEvents
    --ClusterId <string>
    [--max_results <int>]
    [--next_token <string>]
    [--page_number <int>]
    [--page_size <int>]
    [--task_id <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--max_results

Integer

否

单次请求返回的最大结果数

--next_token

String

否

查询凭证(Token),取值为上一次 API 调用返回的next_token参数值

--page_number

Integer

否

分页页数

--page_size

Integer

否

每页显示的最大结果数。
取值范围:[1,100]。
默认值:50

--task_id

String

否

查询的任务ID

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/events --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterLogs

命令描述

您可以调用DescribeClusterLogs接口检索集群的日志数据,以便在出现集群问题时进行根因分析和溯源

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/logs

语法

aliyun cs DescribeClusterLogs
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs GET /clusters/c106f377e16f34eb1808d6b9362c90000/logs --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterNodePoolDetail

命令描述

您可以根据节点池ID,调用DescribeClusterNodePoolDetail接口查询集群中目标节点池的配置

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/nodepools/{NodepoolId}

语法

aliyun cs DescribeClusterNodePoolDetail
    --ClusterId <string>
    --NodepoolId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

示例

aliyun cs GET /clusters/c23421cfa74454bc8b37163fd19af0000/nodepools/np31da1b38983f4511b490fc62108a0000 --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterNodePools

命令描述

查询集群内所有节点池列表

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/nodepools

语法

aliyun cs DescribeClusterNodePools
    --ClusterId <string>
    [--NodepoolName <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolName

String

否

节点池名称

示例

aliyun cs GET /clusters/cc0f87de0b8fb403f86e10e204f830000/nodepools --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterNodes

命令描述

您可以调用DescribeClusterNodes接口,查询符合条件的节点列表信息

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/nodes

语法

aliyun cs DescribeClusterNodes
    --ClusterId <string>
    [--instanceIds <string>]
    [--nodeIps <string>]
    [--nodeLabels <string>]
    [--nodeNames <string>]
    [--nodepool_id <string>]
    [--pageNumber <string>]
    [--pageSize <string>]
    [--state <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--instanceIds

String

否

节点实例ID列表,多值使用英文半角逗号(,)分隔

--nodeIps

String

否

节点 IP 地址列表,多值使用英文半角逗号(,)分隔,用于按节点 IP 批量过滤

--nodeLabels

String

否

根据节点标签过滤节点,格式为使用英文半角逗号(,)分隔 key=value 键值对。多个标签之间为 AND 关系,仅返回同时匹配所有标签的节点

--nodeNames

String

否

节点名称列表,多值使用英文半角逗号(,)分隔,用于按节点名称批量过滤

--nodepool_id

String

否

节点池ID

--pageNumber

String

否

当前查询的页码数。
默认值:1

--pageSize

String

否

每页可显示的最大记录数。取值范围为[1,100]。
默认值:10

--state

String

否

集群节点状态,按照集群节点运行状态进行过滤,取值:
all:不按照运行状态进行过滤,查询所有状态的节点。
running:正在运行的集群节点。
removing:正在删除的集群节点。
initial:正在初始化的集群节点。
failed:创建失败的集群节点。
默认值:all





示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/nodes --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterResources

命令描述

您在使用容器服务 Kubernetes 版过程中,会同时使用其他关联的阿里云云产品资源。您可以调用DescribeClusterResources接口查询指定集群的关联资源,例如VPC、SLB等。如果您需要查询节点池或节点资源,您可以调用DescribeClusterNodePools或DescribeClusterNodes接口

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/resources

语法

aliyun cs DescribeClusterResources
    --ClusterId <string>
    [--with_addon_resources <bool>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID。
关于如何查看集群ID,请参见https://help.aliyun.com/document_detail/89446.html。
您也可通过API接口https://help.aliyun.com/document_detail/183905.html,查看阿里云账号下所有创建的集群信息

--with_addon_resources

Boolean

否

是否同时查询集群组件创建的资源。
true:查询。
false:不查询

示例

aliyun cs GET /clusters/cb95aa626a47740afbf6aa099b650000/resources --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterTasks

命令描述

您可以调用DescribeClusterTasks接口,查询集群下的任务列表

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/tasks

语法

aliyun cs DescribeClusterTasks
    [--cluster_id <string>]
    [--max_results <int>]
    [--next_token <string>]
    [--page_number <int>]
    [--page_size <int>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群id

--max_results

Integer

否

单次请求返回的最大结果数

--next_token

String

否

查询凭证(Token),取值为上一次 API 调用返回的next_token参数值

--page_number

Integer

否

当前页码

--page_size

Integer

否

每页显示数量

示例

aliyun cs GET /clusters/c23421cfa74454bc8b37163fd19af0000/tasks --region cn-hangzhou --page_number 1 --max_results 100 --next_token 'example-string' --page_size 20 --header "Content-Type=application/json"

DescribeClusterUserKubeconfig

命令描述

获取集群kubeconfig接口

HTTP 方法:GET

protocol:HTTPS

url:/k8s/{ClusterId}/user_config

语法

aliyun cs DescribeClusterUserKubeconfig
    --ClusterId <string>
    [--PrivateIpAddress <bool>]
    [--TemporaryDurationMinutes <int>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--PrivateIpAddress

Boolean

否

是否获取内网连接配置。取值:
true:仅获取内网连接凭据。
false:仅获取公网连接凭据。
默认值:false


--TemporaryDurationMinutes

Integer

否

临时KubeConfig有效期,单位:分钟。取值范围:15(15分钟)~4320(3天)。
当不设置该参数时,将由系统自动确定一个更长的有效期,具体过期时间通过返回的expiration字段的值确定

示例

aliyun cs GET /k8s/c5b5e80b0b64a4bf6939d2d8fbbc50000/user_config --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterV2UserKubeconfig

命令描述

获取集群kubeconfig接口

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/api/v2/k8s/{ClusterId}/user_config

语法

aliyun cs DescribeClusterV2UserKubeconfig
    --ClusterId <string>
    [--PrivateIpAddress <bool>]
    [--TemporaryDurationMinutes <int>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--PrivateIpAddress

Boolean

否

是否为内网访问

--TemporaryDurationMinutes

Integer

否

The TemporaryDurationMinutes

示例

aliyun cs GET /api/v2/k8s/example-string/user_config --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusterVuls

命令描述

您可以根据集群ID调用DescribeClusterVuls接口查看集群的安全漏洞详细信息,包括漏洞名称、漏洞类型、漏洞等级等。建议您定期扫描集群的安全漏洞,提高集群安全性

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/vuls

语法

aliyun cs DescribeClusterVuls
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

示例

aliyun cs GET /clusters/c5cdf7e3938bc4f8eb0e44b21a80f0000/vuls --region cn-hangzhou --header "Content-Type=application/json"

DescribeClusters

命令描述

查看容器服务中创建的所有集群(包括Swarm和Kubernetes集群)

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/clusters

语法

aliyun cs DescribeClusters
    [--clusterType <string>]
    [--name <string>]
    [--resource_group_id <string>]
    [options]

参数

参数

类型

必填

说明

--clusterType

String

否

集群类型

--name

String

否

根据集群Name进行模糊匹配查询

--resource_group_id

String

否

用于筛选集群的资源组 ID

示例

aliyun cs GET /clusters --region cn-hangzhou --clusterType ManagedKubernetes --resource_group_id 'rg-a1b2c3d4e5f6g7h' --name test --header "Content-Type=application/json"

DescribeClustersForRegion

命令描述

查询指定地域内全部集群列表

HTTP 方法:GET

protocol:HTTPS

url:/regions/{region_id}/clusters

语法

aliyun cs DescribeClustersForRegion
    [--cluster_id <string>]
    [--cluster_spec <string>]
    [--cluster_type <string>]
    [--name <string>]
    [--page_number <int>]
    [--page_size <int>]
    [--profile <string>]
    --region_id <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--cluster_spec

String

否

查询指定规格的集群。取值:
ack.standard:基础版
ack.pro.small:Pro版
ack.pro.xlarge:Pro XL
ack.pro.2xlarge:Pro 2XL
ack.pro.4xlarge: Pro 4XL (需联系客服开通白名单)
Pro XL、Pro 2XL、Pro 4XL为ACK Pro 预设控制面 (https://help.aliyun.com/ack/ack-managed-and-ack-dedicated/user-guide/ack-pro-provisioned-control-plane)提供的三个档位,通过预先分配并固化控制面资源,确保 API 并发与 Pod 调度能力始终处于确定的高水平状态,适用于 AI 训练推理、超大规模集群及关键任务型业务。
Pro版及预设控制面版本的集群管理费用请参见集群管理费用 (https://help.aliyun.com/ack/ack-managed-and-ack-dedicated/product-overview/cluster-management-fee)






--cluster_type

String

否

查询指定类型的集群,可取值:
Kubernetes: ACK 专有集群。
ManagedKubernetes:ACK 托管类的集群,包括 ACK 托管集群(ACK 集群 Pro 版、ACK 集群基础版)、ACK Serverless 集群(Pro 版、基础版)、ACK Edge 集群(Pro 版、基础版)、ACK 灵骏集群(Pro 版)。
ExternalKubernetes:注册集群


--name

String

否

通过集群名称进行模糊查询

--page_number

Integer

否

页数

--page_size

Integer

否

每页记录数量

--profile

String

否

查询指定子类型的集群,可取值:
Default:ACK 托管集群,包括 ACK 集群 Pro 版和 ACK 集群基础版。
Edge:ACK Edge 集群,包括 ACK Edge 集群 Pro 版和 ACK Edge 集群基础版。
Serverless:ACK Serverless 集群,包括 ACK Serverless 集群 Pro 版和 ACK Serverless 集群基础版。
LingJun:ACK 灵骏集群,提供 Pro 版



--region_id

String

是

地域

示例

aliyun cs GET /regions/cn-hangzhou/clusters --region cn-hangzhou --header "Content-Type=application/json"

DescribeClustersV1

命令描述

您可以调用DescribeClustersV1接口查看本账号下符合条件的ACK集群(例如指定集群类型、集群规格)列表信息

HTTP 方法:GET

protocol:HTTPS

url:/api/v1/clusters

语法

aliyun cs DescribeClustersV1
    [--cluster_id <string>]
    [--cluster_spec <string>]
    [--cluster_type <string>]
    [--name <string>]
    [--page_number <int>]
    [--page_size <int>]
    [--profile <string>]
    [--region_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--cluster_spec

String

否

选择cluster_type为ManagedKubernetes并配置profile时,集群的规格。取值:
ack.standard:基础版
ack.pro.small:Pro版
ack.pro.xlarge:Pro XL
ack.pro.2xlarge:Pro 2XL
ack.pro.4xlarge: Pro 4XL (需联系客服开通白名单)
Pro XL、Pro 2XL、Pro 4XL为ACK Pro 预设控制面 (https://help.aliyun.com/ack/ack-managed-and-ack-dedicated/user-guide/ack-pro-provisioned-control-plane)提供的三个档位,通过预先分配并固化控制面资源,确保 API 并发与 Pod 调度能力始终处于确定的高水平状态,适用于 AI 训练推理、超大规模集群及关键任务型业务。
Pro版及预设控制面版本的集群管理费用请参见集群管理费用 (https://help.aliyun.com/ack/ack-managed-and-ack-dedicated/product-overview/cluster-management-fee)






--cluster_type

String

否

集群类型。
Kubernetes: ACK专有集群。
ManagedKubernetes:ACK托管类的集群,包括ACK托管集群(Pro版、基础版)、ACK Serverless集群(Pro版、基础版)、ACK Edge集群(Pro版、基础版)、ACK灵骏集群(Pro版)。
ExternalKubernetes:注册集群


--name

String

否

集群名称

--page_number

Integer

否

当前页码

--page_size

Integer

否

每页显示的记录数

--profile

String

否

当您选择cluster_type为ManagedKubernetes时,即ACK托管类的集群时,您可以进一步指定集群的子类型。
Default:ACK托管集群,包括ACK集群Pro版和ACK集群基础版。
Edge:ACK Edge集群,包括ACK Edge集群Pro版和ACK Edge集群基础版。
Serverless:ACK Serverless集群,包括ACK Serverless集群Pro版和ACK Serverless集群基础版。
Lingjun:ACK灵骏集群,提供Pro版



--region_id

String

否

集群地域。通过指定该字段,可以过滤出该地域下的集群列表

示例

aliyun cs GET /api/v1/clusters --region cn-hangzhou --cluster_id 'c3fb96524f9274b4495df0f12a6b5****' --page_number 1 --cluster_spec 'ack.pro.small' --name 'cluster-demo' --region_id 'cn-hangzhou' --cluster_type Kubernetes --page_size 10 --header "Content-Type=application/json"

DescribeEvents

命令描述

集群操作事件包括集群创建、集群变更、节点池创建、节点池扩容、Addon安装、集群升级等。您可以调用DescribeEvents接口,查询某类事件的详细信息,包括事件级别、时间状态、事件发生时间等

HTTP 方法:GET

protocol:HTTPS

url:/events

语法

aliyun cs DescribeEvents
    [--cluster_id <string>]
    [--max_results <int>]
    [--next_token <string>]
    [--page_number <int>]
    [--page_size <int>]
    [--type <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--max_results

Integer

否

单次请求返回的最大结果数

--next_token

String

否

查询凭证(Token),取值为上一次 API 调用返回的NextToken参数值

--page_number

Integer

否

分页查询页数

--page_size

Integer

否

每页显示的最大结果数。
取值范围:[1,100]。
默认值:50

--type

String

否

事件类型。不设置则查询所有类型的事件。取值:
cluster_create:创建集群。
cluster_scaleout:扩容集群。
cluster_attach:添加已有节点。
cluster_delete:删除集群。
cluster_upgrade:升级集群。
cluster_migrate:迁移集群。
cluster_node_delete:移除节点。
cluster_node_drain:清空节点。
cluster_modify:修改集群。
cluster_configuration_modify:修改集群管控配置。
cluster_addon_install:安装组件。
cluster_addon_upgrade:升级组件。
cluster_addon_uninstall:卸载组件。
runtime_upgrade:升级运行时。
nodepool_upgrade:升级节点池。
nodepool_update:更新节点池















示例

aliyun cs GET /events --region cn-hangzhou --cluster_id 'cf62854ac2130470897be7a27ed1f****' --page_number 1 --max_results 10 --type nodepool_upgrade --next_token '5c0a1c0f91c14c6****' --page_size 50 --header "Content-Type=application/json"

DescribeEventsForRegion

命令描述

查询指定地域内全部事件列表

HTTP 方法:GET

protocol:HTTPS

url:/regions/{region_id}/events

语法

aliyun cs DescribeEventsForRegion
    [--cluster_id <string>]
    [--max_results <int>]
    [--next_token <string>]
    [--page_number <int>]
    [--page_size <int>]
    --region_id <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--max_results

Integer

否

单次请求返回的最大结果数

--next_token

String

否

查询凭证(Token),取值为上一次 API 调用返回的next_token参数值

--page_number

Integer

否

分页页数

--page_size

Integer

否

每页显示的最大结果数。
取值范围:[1,100]。
默认值:50

--region_id

String

是

地域ID

示例

aliyun cs GET /regions/cn-hangzhou/events --region cn-hangzhou --header "Content-Type=application/json"

DescribeExternalAgent

命令描述

根据集群ID查询集群中部署注册集群的代理配置

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/k8s/{ClusterId}/external/agent/deployment

语法

aliyun cs DescribeExternalAgent
    [--AgentMode <string>]
    --ClusterId <string>
    [--PrivateIpAddress <string>]
    [options]

参数

参数

类型

必填

说明

--AgentMode

String

否

Agent权限模式。
admin:管理员模式,拥有所有权限。
restricted:受限模式,仅拥有部分权限。
默认值:admin


--ClusterId

String

是

集群ID

--PrivateIpAddress

String

否

是否获取内网访问凭据。
true:仅获取内网连接凭据。
false:仅获取公网连接凭据。
默认值:false


示例

aliyun cs GET /k8s/c106f377e16f34eb1808d6b9362c90000/external/agent/deployment --region cn-hangzhou --header "Content-Type=application/json"

DescribeKubernetesVersionMetadata

命令描述

您可以调用DescribeKubernetesVersionMetadata接口查询Kubernetes版本的详细信息,包括Kubernetes版本信息、版本的发布日期和过期时间、兼容的操作系统,使用的运行时等

HTTP 方法:GET

protocol:HTTPS

url:/api/v1/metadata/versions

语法

aliyun cs DescribeKubernetesVersionMetadata
    --ClusterType <string>
    [--KubernetesVersion <string>]
    [--Mode <string>]
    [--Profile <string>]
    [--QueryUpgradableVersion <bool>]
    --Region <string>
    [--runtime <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterType

String

是

集群类型,取值:
Kubernetes: ACK专有版集群。
ManagedKubernetes:ACK托管版集群,包括ACK Pro版集群、ACK基础版集群、ACK Serverless Pro版集群、ACK Serverless基础版集群、ACK Edge Pro版集群、ACK Edge基础版

--KubernetesVersion

String

否

集群版本,与Kubernetes社区基线版本保持一致。建议选择最新版本,若不指定,默认使用最新版本。
ACK支持的Kubernetes版本,请参见https://help.aliyun.com/document_detail/185269.html

--Mode

String

否

查询模式,取值:
supported:查询受支持版本。
creatable:查询可创建版本。
若指定KubernetesVersion,将忽略查询模式。
若不指定查询模式,默认返回可创建版本



--Profile

String

否

面向场景时的集群类型,取值:
Default:非边缘场景集群。
Edge:边缘场景集群。
Serverless:ASK集群。
默认值:Default



--QueryUpgradableVersion

Boolean

否

是否查询该集群版本的可升级版本,仅在指定KubernetesVersion参数时生效。
true:查询可升级版本。
false:不查询可升级版本

--Region

String

是

集群所在地域ID

--runtime

String

否

运行时类型,可以通过指定运行时类型,过滤出运行时所支持的系统镜像,取值:
docker:docker运行时。
containerd:containerd运行时。
Sandboxed-Container.runv:安全沙箱。
若指定运行时类型,将返回指定运行时支持的镜像版本。
若不指定运行时类型,默认返回全部镜像




示例

aliyun cs GET /api/v1/metadata/versions --region cn-hangzhou --Region 'cn-beijing' --ClusterType Kubernetes --header "Content-Type=application/json"

DescribeNodePoolVuls

命令描述

您可以根据节点池ID调用DescribeNodePoolVuls接口查看节点池的安全漏洞详细信息,包括漏洞名称、漏洞等级等。建议您定期扫描节点池的安全漏洞,提高集群安全性

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/vuls

语法

aliyun cs DescribeNodePoolVuls
    --cluster_id <string>
    [--necessity <string>]
    --nodepool_id <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

集群ID

--necessity

String

否

要查询的漏洞修复必要性等级。多个等级之间使用半角逗号(,)分隔。取值:
asap:高
later:中
nntf:低


--nodepool_id

String

是

节点池ID

示例

aliyun cs GET /clusters/c17e742cee942410486f237293d660000/nodepools/np38f32fdbc60e4a1e957ffde778460000/vuls --region cn-hangzhou --header "Content-Type=application/json"

DescribePolicies

命令描述

ACK集群容器安全策略供了种类丰富的内置规则库,包括Compliance、Infra、K8s-general和PSP,旨在确保容器在生产环境中的安全运行。您可以调用DescribePolicies接口,查询策略治理规则库的列表

HTTP 方法:GET

protocol:HTTPS

url:/policies

语法

aliyun cs DescribePolicies
    [options]

参数

该命令没有专属参数。CLI 通用选项见“全局选项”。

示例

aliyun cs GET /policies --region cn-hangzhou --header "Content-Type=application/json"

DescribePolicyDetails

命令描述

ACK集群容器安全策略供了种类丰富的内置规则库,包括Compliance、Infra、K8s-general和PSP,旨在确保容器在生产环境中的安全运行。您可以调用DescribePolicyDetails接口,查询指定策略治理规则的详细信息,例如规则模板描述、规则治理动作、规则治理等级等

HTTP 方法:GET

protocol:HTTPS

url:/policies/{policy_name}

语法

aliyun cs DescribePolicyDetails
    --policy_name <string>
    [options]

参数

参数

类型

必填

说明

--policy_name

String

是

策略治理规则名称

示例

aliyun cs GET /policies/ACKAllowedRepos --region cn-hangzhou --header "Content-Type=application/json"

DescribePolicyGovernanceInCluster

命令描述

ACK集群容器安全策略供了种类丰富的内置规则库,包括Compliance、Infra、K8s-general和PSP,旨在确保容器在生产环境中的安全运行。您可以调用DescribePolicyGovernanceInCluster接口,查询目标集群策略治理的详细信息,例如集群当前启用的不同等级策略计数统计、策略治理审计日志、拦截和告警情况等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/policygovernance

语法

aliyun cs DescribePolicyGovernanceInCluster
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

目标集群ID

示例

aliyun cs GET /clusters/c8155823d057948c69a0000/policygovernance --region cn-hangzhou --header "Content-Type=application/json"

DescribePolicyInstances

命令描述

您可以在ACK集群中选择安全策略类型,配置相关实施动作、作用范围等,创建并部署一个策略实例。您可以调用DescribePolicyInstances接口,获取集群中指定策略规则实例的详细信息,例如策略描述、治理等级等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/policies

语法

aliyun cs DescribePolicyInstances
    --cluster_id <string>
    [--instance_name <string>]
    [--policy_name <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

目标集群ID

--instance_name

String

否

策略实例名称

--policy_name

String

否

策略治理规则名称

示例

aliyun cs GET /clusters/c8155823d057948c69a0000/policies --region cn-hangzhou --header "Content-Type=application/json"

DescribePolicyInstancesStatus

命令描述

您可以调用DescribePolicyInstancesStatus接口,查询集群当前不同策略类型对应的实例部署状态,包括每种策略规则对应开启的实例计数,以及不同治理等级下开启的策略种类计数

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/policies/status

语法

aliyun cs DescribePolicyInstancesStatus
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

目标集群ID

示例

aliyun cs GET /clusters/c8155823d057948c69a0000/policies/status --region cn-hangzhou --header "Content-Type=application/json"

DescribeRegions

命令描述

查询地域列表

HTTP 方法:GET

protocol:HTTPS

url:/regions

语法

aliyun cs DescribeRegions
    [--acceptLanguage <string>]
    [--clusterType <string>]
    [--profile <string>]
    [options]

参数

参数

类型

必填

说明

--acceptLanguage

String

否

根据汉语、英语筛选返回结果

  • 约束:

    • 允许值:["zh-CN", "en-US"]

--clusterType

String

否

集群类型

  • 约束:

    • 允许值:["Kubernetes", "ManagedKubernetes", "ExternalKubernetes"]

--profile

String

否

托管类集群子类型

  • 约束:

    • 允许值:["Default", "Serverless", "Edge", "Lingjun"]

示例

aliyun cs GET /regions --region cn-hangzhou --clusterType ManagedKubernetes --acceptLanguage 'zh-CN' --header "Content-Type=application/json"

DescribeResourcesDeleteProtection

命令描述

查询集群内的指定资源是否开启删除保护,当前支持删除保护的资源包括命名空间和服务

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/resources/{ResourceType}/protection

语法

aliyun cs DescribeResourcesDeleteProtection
    --ClusterId <string>
    --ResourceType <string>
    [--namespace <string>]
    [--resources <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

ACK集群ID

--ResourceType

String

是

待查询的资源类型。取值如下:
namespaces:命名空间。
services:服务

  • 约束:

    • 允许值:["namespaces", "services"]

--namespace

String

否

待查询资源所在的命名空间。
resource_type选择为services时该参数必须填写,若未填写则默认按照命名空间为default处理

--resources

String

否

查询的目标资源名称,多个资源以英文半角逗号(,)分割。
resource_type选择为namespaces时,本参数需要填写为命名空间名称。若不填写,则查询集群下所有命名空间的删除保护状态。
resource_type选择为services时,本参数必须填写,需要填写为服务名称

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/resources/namespaces/protection --region cn-hangzhou --header "Content-Type=application/json"

DescribeSubaccountK8sClusterUserConfig

命令描述

作为集群权限管理者,您可以使用阿里云账号(主账号)为账号内指定RAM用户或RAM角色签发包含其身份信息的KubeConfig凭证,用于连接ACK集群。您可以调用DescribeSubaccountK8sClusterUserConfig接口,签发或获取账号内任意RAM用户或角色的KubeConfig

HTTP 方法:GET

protocol:HTTPS

url:/k8s/{ClusterId}/users/{Uid}/user_config

语法

aliyun cs DescribeSubaccountK8sClusterUserConfig
    --ClusterId <string>
    [--PrivateIpAddress <bool>]
    [--TemporaryDurationMinutes <int>]
    --Uid <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--PrivateIpAddress

Boolean

否

是否获取内网连接配置。取值:
true:仅获取内网连接的KubeConfig凭证。
false:仅获取公网连接的KubeConfig凭证。
默认值:false


--TemporaryDurationMinutes

Integer

否

临时KubeConfig有效期,单位:分钟。
取值范围:[15, 4320],即最长3天。
当不设置该参数时,将由系统自动确定一个更长的有效期,具体过期时间通过返回的expiration字段的值确定

--Uid

String

是

阿里云账号内指定的RAM用户或RAM角色ID

示例

aliyun cs GET /k8s/c5b5e80b0b64a4bf6939d2d8f0000/users/265624438516500000/user_config --region cn-hangzhou --header "Content-Type=application/json"

DescribeTaskInfo

命令描述

您可以调用DescribeTaskInfo接口,查询集群任务的详细信息,例如任务类型、运行状态、运行阶段等

HTTP 方法:GET

protocol:HTTPS

url:/tasks/{task_id}

语法

aliyun cs DescribeTaskInfo
    --task_id <string>
    [options]

参数

参数

类型

必填

说明

--task_id

String

是

任务ID

示例

aliyun cs GET /tasks/T-5faa48fb31b6b8078d000000 --region cn-hangzhou --header "Content-Type=application/json"

DescribeTemplateAttribute

命令描述

编排模板是对一组Kubernetes集群资源的定义和描述,以声明性方式描述应用应该如何运行或者配置。您可以调用DescribeTemplateAttribute接口,查询目标编排模板的详细信息,包括访问权限、YAML内容、标签等

HTTP 方法:GET

protocol:HTTPS

url:/templates/{TemplateId}

语法

aliyun cs DescribeTemplateAttribute
    --TemplateId <string>
    [--template_type <string>]
    [options]

参数

参数

类型

必填

说明

--TemplateId

String

是

模板ID

--template_type

String

否

模板类型。
当取值为kubernetes时将在控制台的编排模板页面展示该模板。
该参数不填写或者取值为其他值时,控制台的编排模板页面将不会展示该模板。
推荐设置为kubernetes


示例

aliyun cs GET /templates/874ec485-e7e6-4373-8a3b-47bde8a0000 --region cn-hangzhou --header "Content-Type=application/json"

DescribeTemplates

命令描述

编排模板是对一组Kubernetes集群资源的定义和描述,以声明性方式描述应用应该如何运行或者配置。您可以调用DescribeTemplates接口获取已创建的编排模板的列表,并查询编排模板的详细信息,包括访问权限、YAML内容、标签等

HTTP 方法:GET

protocol:HTTPS

url:/templates

语法

aliyun cs DescribeTemplates
    [--page_num <int>]
    [--page_size <int>]
    [--template_type <string>]
    [options]

参数

参数

类型

必填

说明

--page_num

Integer

否

对查询结果进行分页处理,指定返回第几页的数据。
默认值: 1

--page_size

Integer

否

对查询结果进行分页处理,指定每页包含的数据条数。
默认值:10

--template_type

String

否

模板类型。
当取值为kubernetes时将在控制台的编排模板页面展示该模板。
该参数不填写或者取值为其他值时,控制台的编排模板页面将不会展示该模板。
推荐设置为kubernetes


示例

aliyun cs GET /templates --region cn-hangzhou --page_num 1 --template_type kubernetes --page_size 10 --header "Content-Type=application/json"

DescribeTrigger

命令描述

您可以调用DescribeTrigger接口,查询符合条件的触发器

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/triggers

语法

aliyun cs DescribeTrigger
    --Name <string>
    --Namespace <string>
    [--Type <string>]
    [--action <string>]
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--Name

String

是

应用名称

--Namespace

String

是

应用所属命名空间

--Type

String

否

触发器类型。取值:
deployment:针对无状态应用的触发器。
application:针对应用中心应用的触发器。
默认值:deployment。
当不指定触发器类型时,查询结果将不过滤触发器类型



--action

String

否

触发器行为,取值:
redeploy:重新部署应用。
当不指定触发器行为时,查询结果将不过滤触发器行为

--cluster_id

String

是

集群ID

示例

aliyun cs GET /clusters/c5cdf7e3938bc4f8eb0e44b21a80f0000/triggers --region cn-hangzhou --Namespace default --Name 'web-server' --header "Content-Type=application/json"

DescribeUserClusterNamespaces

命令描述

在ACK集群中,可以通过Kubernetes命名空间对集群访问者进行权限和资源的逻辑隔离,只被授予指定命名空间下RBAC权限的用户将无法访问集群其他命名空间内的资源。您可以调用DescribeUserClusterNamespaces接口,查看当前RAM用户或角色在指定的ACK集群内被授予了哪些命名空间内资源的RBAC访问权限

HTTP 方法:GET

protocol:HTTPS

url:/api/v2/k8s/{ClusterId}/namespaces

语法

aliyun cs DescribeUserClusterNamespaces
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs GET /api/v2/k8s/c5b5e80b0b64a4bf6939d2d8fbbc50000/namespaces --region cn-hangzhou --header "Content-Type=application/json"

DescribeUserPermission

命令描述

在ACK集群中,您可以创建并指定不同RAM用户或角色拥有不同的访问权限,从而确保安全访问控制和资源隔离。您可以调用DescribeUserPermission接口查询RAM用户或角色拥有的集群权限详情,包括可访问的资源、权限的作用范围、预置的角色类型、权限来源等

HTTP 方法:GET

protocol:HTTPS

url:/permissions/users/{uid}

语法

aliyun cs DescribeUserPermission
    --uid <string>
    [options]

参数

参数

类型

必填

说明

--uid

String

是

指定RAM用户或RAM角色的ID。
若查询RAM用户权限,则使用RAM用户的UID。
若查询RAM角色权限,则使用RAM角色的ID

示例

aliyun cs GET /permissions/users/206945240368000000 --region cn-hangzhou --header "Content-Type=application/json"

DescribeUserQuota

命令描述

您可以调用DescribeUserQuota接口,查询ACK集群、节点池、节点的相关配额。如需扩大配额,请前往配额中心申请

HTTP 方法:GET

protocol:HTTPS

url:/quota

语法

aliyun cs DescribeUserQuota
    [options]

参数

该命令没有专属参数。CLI 通用选项见“全局选项”。

示例

aliyun cs GET /quota --region cn-hangzhou --header "Content-Type=application/json"

FixNodePoolVuls

命令描述

阿里云云安全产品会定期扫描ECS节点上的安全漏洞,并提供对应的修复建议与方法。某些CVE的修复可能需要重启节点,请确保集群有充足的节点用于排水操作。您可以调用FixNodePoolVuls接口修复指定集群节点池的节点漏洞,提高集群节点的安全性

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/vuls/fix

语法

aliyun cs FixNodePoolVuls
    [--body <string>]
    --cluster_id <string>
    --nodepool_id <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--cluster_id

String

是

集群ID

--nodepool_id

String

是

节点池ID

示例

aliyun cs POST /clusters/cf62854ac2130470897be7a27ed1f0000/nodepools/np31da1b38983f4511b490fc62108a0000/vuls/fix --region cn-hangzhou --header "Content-Type=application/json"

GetClusterAddonInstance

命令描述

您可以调用GetClusterAddonInstance接口查询集群中目标组件的详细信息,包括目标组件实例的版本、参数配置、日志功能启用状态等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/addon_instances/{instance_name}

语法

aliyun cs GetClusterAddonInstance
    [--cluster_id <string>]
    [--instance_name <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--instance_name

String

否

组件实例名称

示例

aliyun cs GET /clusters/c02b3e03be10643e8a644a843ffcb0000/addon_instances/ack-node-problem-detector --region cn-hangzhou --header "Content-Type=application/json"

GetClusterAuditProject

命令描述

您可以调用GetClusterAuditProject查看集群是否开启API Server审计功能以及API Server审计日志对应的SLS Project

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{clusterid}/audit

语法

aliyun cs GetClusterAuditProject
    --clusterid <string>
    [options]

参数

参数

类型

必填

说明

--clusterid

String

是

ACK集群ID

示例

aliyun cs GET /clusters/cad1230511cbb4db4a488e58518000000/audit --region cn-hangzhou --header "Content-Type=application/json"

GetClusterCheck

命令描述

容器智能运维平台提供丰富的Kubernetes集群检查能力,包括集群升级检查、集群迁移检查、组件安装检查、组件升级检查、节点池检查等。您可以调用GetClusterCheck接口,根据集群ID和检查任务ID查看指定检查任务的相关信息,例如检查状态、具体检查项、检查创建和完成时间等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/checks/{check_id}

语法

aliyun cs GetClusterCheck
    --check_id <string>
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--check_id

String

是

检查ID。
您可以调用 https://help.aliyun.com/document_detail/2667902.html 获取该check_id

--cluster_id

String

是

集群ID

示例

aliyun cs GET /clusters/ce0da5a1d627e4e9e9f96cae8ad070000/checks/1697100584236600453-ce0da5a1d627e4e9e9f96cae8ad070000-clustercheck-lboto --region cn-hangzhou --header "Content-Type=application/json"

GetClusterDiagnosisCheckItems

命令描述

获取集群诊断检查项

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/diagnosis/{diagnosis_id}/check_items

语法

aliyun cs GetClusterDiagnosisCheckItems
    [--cluster_id <string>]
    [--diagnosis_id <string>]
    [--language <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--diagnosis_id

String

否

诊断ID

--language

String

否

查询语言

示例

aliyun cs GET /clusters/cb95aa626a47740afbf6aa099b6500000/diagnosis/6f719f23098240818eb26fe3a37d0000/check_items --region cn-hangzhou --header "Content-Type=application/json"

GetClusterDiagnosisResult

命令描述

获取集群诊断结果

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/diagnosis/{diagnosis_id}/result

语法

aliyun cs GetClusterDiagnosisResult
    [--cluster_id <string>]
    [--diagnosis_id <string>]
    [--language <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--diagnosis_id

String

否

诊断ID

--language

String

否

查询语言

示例

aliyun cs GET /clusters/c8155823d057948c69a0000/diagnosis/6f719f23098240818eb26fe3a37d0000/result --region cn-hangzhou --header "Content-Type=application/json"

GetClusterInspectConfig

命令描述

获取集群巡检配置

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{clusterId}/inspectConfig

语法

aliyun cs GetClusterInspectConfig
    --clusterId <string>
    [options]

参数

参数

类型

必填

说明

--clusterId

String

是

集群ID

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/inspectConfig --region cn-hangzhou --header "Content-Type=application/json"

GetClusterInspectReportDetail

命令描述

获取集群巡检报告详情

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{clusterId}/inspectReports/{reportId}

语法

aliyun cs GetClusterInspectReportDetail
    [--category <string>]
    --clusterId <string>
    [--enableFilter <bool>]
    [--language <string>]
    [--level <string>]
    [--maxResults <int>]
    [--nextToken <string>]
    --reportId <string>
    [--targetType <string>]
    [options]

参数

参数

类型

必填

说明

--category

String

否

巡检项归属领域。取值:
security:安全合规
performance:性能效率
stability:业务稳定
limitation:服务限制
cost:成本优化




--clusterId

String

是

集群ID

--enableFilter

Boolean

否

检查项过滤,为true仅返回result=true的异常检查项

--language

String

否

查询语言。
zh_CN
en_US

--level

String

否

巡检项所属级别。取值:
advice:建议
warning:低危
error:中危
critical:高危



--maxResults

Integer

否

每页最大条目数,最大值50

--nextToken

String

否

分页token

--reportId

String

是

巡检报告ID

--targetType

String

否

巡检对象类型,仅返回符合targetType的检查项

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/inspectReports/782df89346054a0000562063a0000 --region cn-hangzhou --header "Content-Type=application/json"

GetKubernetesTrigger

命令描述

根据应用名称查询该应用的触发器

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/triggers/{ClusterId}

语法

aliyun cs GetKubernetesTrigger
    --ClusterId <string>
    --Name <string>
    --Namespace <string>
    [--Type <string>]
    [--action <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--Name

String

是

应用名称

--Namespace

String

是

命名空间名称

--Type

String

否

触发器类型。取值:
deployment:针对无状态应用的触发器。
application:针对应用中心应用的触发器。
默认值:deployment。
当不指定触发器类型时,查询结果将不过滤触发器类型



--action

String

否

触发器行为,取值:
redeploy:重新部署project_id中定义的资源。
当不指定触发器行为时,查询结果将不过滤触发器行为

示例

aliyun cs GET /triggers/c5cdf7e3938bc4f8eb0e44b21a80f0000 --region cn-hangzhou --Namespace default --Name 'web-server' --header "Content-Type=application/json"

GetUpgradeStatus

命令描述

根据集群ID,查询该集群的升级状态

已弃用:true

HTTP 方法:GET

protocol:HTTPS

url:/api/v2/clusters/{ClusterId}/upgrade/status

语法

aliyun cs GetUpgradeStatus
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs GET /api/v2/clusters/c106f377e16f34eb1808d6b9362c90000/upgrade/status --region cn-hangzhou --header "Content-Type=application/json"

GrantPermissions

命令描述

非集群创建者、没有被授予过所有集群维度权限的RAM用户或角色在集群中默认没有任何RBAC权限。您可以调用GrantPermissions接口,更新RAM用户或角色拥有的RBAC访问权限,包括可访问的资源、权限的作用范围、预置的角色类型等,从而更好地管理集群的安全访问控制

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/permissions/users/{uid}

语法

aliyun cs GrantPermissions
    [--body <array>]
    --uid <string>
    [options]

参数

参数

类型

必填

说明

--body

List

否

请求体参数

--uid

String

是

RAM用户或RAM角色的ID

示例

aliyun cs POST /permissions/users/23670000 --region cn-hangzhou --header "Content-Type=application/json" --body '[{"role_name":"ops","cluster":"c796c60***","role_type":"cluster"}]'

InstallClusterAddons

命令描述

为了增强Kubernetes能力,ACK集群支持了多种组件,例如托管的核心组件,应用、日志和监控、网络、存储、安全组件等。您可以调用InstallClusterAddons接口,通过组件名称和版本安装组件

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/components/install

语法

aliyun cs InstallClusterAddons
    --ClusterId <string>
    [--body <array>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

List

否

请求体参数

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/components/install --region cn-hangzhou --header "Content-Type=application/json" --body '[{"name":"storage-operato","version":"v1.32.9"}]'

InstallNodePoolComponents

命令描述

安装节点组件,支持配置并指定节点安装节点组件

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterId}/nodepools/{nodePoolId}/components

语法

aliyun cs InstallNodePoolComponents
    [--body <string>]
    [--clusterId <string>]
    [--nodePoolId <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--clusterId

String

否

集群ID

--nodePoolId

String

否

节点池ID

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/nodepools/np7c4fa4a5f1ce412b8490000/components --region cn-hangzhou --header "Content-Type=application/json" --body '{"components":[{"name":"kubelet","version":"1.28.9-aliyun.1","config":{"customConfig":{"cpuManagerPolicy":"static"},"envs":[{"name":"LOG_LEVEL","value":"info"}]}}],"rollingPolicy":{"maxFailedNodes":0,"maxParallelism":1,"batchInterval":0,"pausePolicy":"NotPause"},"nodeNames":["cn-hangzhou.10.2xxx"]}'

ListAddons

命令描述

您可以调用ListAddons接口,根据指定地域、集群类型、集群子类型(profile)、集群版本等参数获取可用组件的列表,并查询组件的详细信息,包括组件托管与否、支持的自定义参数Schema、兼容的操作系统架构等

HTTP 方法:GET

protocol:HTTPS

url:/addons

语法

aliyun cs ListAddons
    [--cluster_id <string>]
    [--cluster_spec <string>]
    [--cluster_type <string>]
    [--cluster_version <string>]
    [--profile <string>]
    [--region_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID。
指定集群ID时,查询该集群可用的组件列表,此时其他参数将会被忽略

--cluster_spec

String

否

集群规格。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--cluster_type

String

否

集群类型。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--cluster_version

String

否

集群版本。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--profile

String

否

集群子类型。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

--region_id

String

否

地域。
如果传入了cluster_id,该参数将被忽略。
region_id、cluster_type、profile、cluster_spec、cluster_version五个参数需要同时传入

示例

aliyun cs GET /addons --region cn-hangzhou --cluster_version '1.32.1-aliyun.1' --cluster_id 'c02b3e03be10643e8a644a843ffcb****' --cluster_spec 'ack.pro.small' --region_id 'cn-hangzhou' --cluster_type ManagedKubernetes --header "Content-Type=application/json"

ListAutoRepairPolicies

命令描述

获取自愈规则列表

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/auto_repair_policies

语法

aliyun cs ListAutoRepairPolicies
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

示例

aliyun cs GET /clusters/ce0da5a1d627e4e9e9f96cae8ad070000/auto_repair_policies --region cn-hangzhou --header "Content-Type=application/json"

ListClusterAddonInstanceResources

命令描述

查询已安装的集群组件实例所包含的资源列表,包括Kubernetes集群资源、Helm发布实例等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/addon_instances/{instance_name}/resources

语法

aliyun cs ListClusterAddonInstanceResources
    [--cluster_id <string>]
    [--instance_name <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--instance_name

String

否

组件实例名称

示例

aliyun cs GET /clusters/cb95aa626a47740afbf6aa099b6500000/addon_instances/terway-eniip/resources --region cn-hangzhou --header "Content-Type=application/json"

ListClusterAddonInstances

命令描述

您可以调用ListClusterAddonInstances接口获取目标集群已安装的组件实例列表并查询组件实例的相关信息,包括组件版本、状态等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/addon_instances

语法

aliyun cs ListClusterAddonInstances
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

示例

aliyun cs GET /clusters/c02b3e03be10643e8a644a843ffcb0000/addon_instances --region cn-hangzhou --header "Content-Type=application/json"

ListClusterChecks

命令描述

容器智能运维平台提供丰富的Kubernetes集群检查能力,包括集群升级检查、集群迁移检查、组件安装检查、组件升级检查、节点池检查等。您可以调用ListClusterChecks接口,根据集群ID查询集群检查的列表和检查相关信息,例如检查类型、状态、创建和完成时间等

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/checks

语法

aliyun cs ListClusterChecks
    [--cluster_id <string>]
    [--target <string>]
    [--type <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--target

String

否

筛选指定的检查对象

--type

String

否

检查类型。
ClusterMigrate:集群迁移。
MasterUpgrade:集群控制面升级。
NodePoolUpgrade:节点池升级。
ClusterUpgrade:集群升级



示例

aliyun cs GET /clusters/ce0da5a1d627e4e9e9f96cae8ad070000/checks --region cn-hangzhou --type ClusterUpgrade --target 'ngw-bp19ay6nnvd4cexxxx' --header "Content-Type=application/json"

ListClusterInspectReports

命令描述

获取集群巡检报告列表

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{clusterId}/inspectReports

语法

aliyun cs ListClusterInspectReports
    --clusterId <string>
    [--maxResults <int>]
    [--nextToken <string>]
    [options]

参数

参数

类型

必填

说明

--clusterId

String

是

集群ID

--maxResults

Integer

否

最大返回结果数,最大值50

--nextToken

String

否

分页token

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/inspectReports --region cn-hangzhou --header "Content-Type=application/json"

ListClusterKubeconfigStates

命令描述

如果您需要查看当前集群的访问控制情况,您可以调用ListClusterKubeconfigStates接口来获取当前集群已下发用户KubeConfig的列表以及状态

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{ClusterId}/kubeconfig/states

语法

aliyun cs ListClusterKubeconfigStates
    [--ClusterId <string>]
    [--cloudServiceKubeConfig <bool>]
    [--pageNumber <int>]
    [--pageSize <int>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

否

集群ID

--cloudServiceKubeConfig

Boolean

否

是否查询集群内云产品服务角色 KubeConfig 列表
true: 查询集群内云产品服务角色 KubeConfig 列表
false: 查询集群内RAM用户/角色 KubeConfig 列表

--pageNumber

Integer

否

页码。
取值范围:大于等于1
默认值:1

--pageSize

Integer

否

每页记录数。
取值范围:1-50
默认值:10

示例

aliyun cs GET /clusters/c82e6987e2961451182edacd74faf0000/kubeconfig/states --region cn-hangzhou --pageNumber 1 --cloudServiceKubeConfig true --pageSize 10 --header "Content-Type=application/json"

ListNodePoolComponentInstanceNodes

命令描述

查询节点组件在节点上的状态

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/component_instances/{name}/nodes

语法

aliyun cs ListNodePoolComponentInstanceNodes
    --cluster_id <string>
    [--config_revision <string>]
    [--max_results <int>]
    --name <string>
    [--next_token <string>]
    [--node_names <array>]
    --nodepool_id <string>
    [--version <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

集群ID

--config_revision

String

否

过滤指定节点组件配置版本号的节点

--max_results

Integer

否

分页控制:单次响应返回的最大记录数。默认 20

--name

String

是

组件名称

--next_token

String

否

分页游标:首次请求不传;后续请求填入上一次响应返回的 token

--node_names

List

否

指定查询节点名称列表

--nodepool_id

String

是

节点池ID

--version

String

否

过滤指定节点组件版本的节点

示例

aliyun cs GET /clusters/c2230fxxxxx/nodepools/np8d8c9c2cd0f64e89884f82a5fbcd0000/component_instances/kubelet/nodes --region cn-hangzhou --header "Content-Type=application/json"

ListNodePoolComponentInstances

命令描述

查询节点组件实例列表

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/component_instances

语法

aliyun cs ListNodePoolComponentInstances
    --cluster_id <string>
    [--max_results <int>]
    [--next_token <string>]
    --nodepool_id <string>
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

是

集群ID

--max_results

Integer

否

分页参数,默认值200

--next_token

String

否

分页参数

--nodepool_id

String

是

节点池ID

示例

aliyun cs GET /clusters/c846d7d529e340000/nodepools/np8d8c9c2cd0f64e89884f82a5fbcd0000/component_instances --region cn-hangzhou --header "Content-Type=application/json"

ListNodePoolComponents

命令描述

查询节点池可安装的节点组件

HTTP 方法:GET

protocol:HTTPS

url:/clusters/{cluster_id}/nodepool_components

语法

aliyun cs ListNodePoolComponents
    [--cluster_id <string>]
    [--image_id <string>]
    [--image_type <string>]
    [--instance_types <string>]
    [--max_results <int>]
    [--next_token <string>]
    [--nodepool_id <string>]
    [--nodepool_type <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--image_id

String

否

节点池镜像ID。在未指定nodepool_id的情况下,和image_type参数二选一,必填

--image_type

String

否

节点池镜像类型。在未指定nodepool_id的情况下,和image_id参数二选一,必填

--instance_types

String

否

节点池实例规格。在未指定nodepool_id的情况下,参数必填

--max_results

Integer

否

分页参数,默认值200

--next_token

String

否

分页参数

--nodepool_id

String

否

节点池ID。指定节点池 ID 时,查询该节点池可用的组件列表,此时其他参数将会被忽略

--nodepool_type

String

否

节点池类型。在未指定nodepool_id的情况下,参数必填

示例

aliyun cs GET /clusters/c846d7d529e340000/nodepool_components --region cn-hangzhou --instance_types '["ecs.c6.xlarge"]' --max_results 10 --image_id 'aliyun_3_x64_20G_container_optimized_alibase_20250629.vhd' --next_token '5c0a1c0f91c14c6****' --nodepool_id 'np1855b102ac434f5990d87b77a****' --nodepool_type ess --image_type AliyunLinux3 --header "Content-Type=application/json"

ListOperationPlans

命令描述

获取自动运维执行计划列表

HTTP 方法:GET

protocol:HTTPS

url:/operation/plans

语法

aliyun cs ListOperationPlans
    [--cluster_id <string>]
    [--type <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

--type

String

否

执行计划类型

示例

aliyun cs GET /operation/plans --region cn-hangzhou --cluster_id 'c29ced64b3dfe4f33b57ca0aa9f68****' --type cluster_upgrade --header "Content-Type=application/json"

ListOperationPlansForRegion

命令描述

查询指定地域内最近100条自动运维执行计划列表。开启集群智能托管模式Auto Mode、集群自动升级、节点池自动化运维等功能时,您可以通过该接口查询由系统自动生成的运维计划及其执行情况,例如集群升级、节点池CVE修复等

HTTP 方法:GET

protocol:HTTPS

url:/regions/{region_id}/operation/plans

语法

aliyun cs ListOperationPlansForRegion
    [--cluster_id <string>]
    --region_id <string>
    [--state <string>]
    [--type <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

按集群ID过滤

--region_id

String

是

地域ID

--state

String

否

按执行计划状态过滤

--type

String

否

按执行计划类型过滤

示例

aliyun cs GET /regions/cn-beijing/operation/plans --region cn-hangzhou --header "Content-Type=application/json"

ListTagResources

命令描述

您可以为集群添加标签键值对,让集群开发或运维人员能够更灵活地对集群进行分类管理,更好的支持监控、成本分析、租户隔离等需求。您可以调用ListTagResources接口,获取资源标签的列表并查询标签的详细信息,例如键值对、绑定的集群等

HTTP 方法:GET

protocol:HTTPS

url:/tags

语法

aliyun cs ListTagResources
    [--next_token <string>]
    --region_id <string>
    --resource_ids <string>
    --resource_type <string>
    [--tags <string>]
    [options]

参数

参数

类型

必填

说明

--next_token

String

否

下一个查询开始的令牌

--region_id

String

是

地域ID

--resource_ids

String

是

要查询的资源ID列表

--resource_type

String

是

资源类型。
CLUSTER:集群

--tags

String

否

要查询的标签列表,限制最多包含20个子项

示例

aliyun cs GET /tags --region cn-hangzhou --resource_type CLUSTER --region_id 'cn-beijing' --resource_ids '["xxxxx","xxxxxx"]' --header "Content-Type=application/json"

ListUserKubeConfigStates

命令描述

如果您需要查看当前用户各个集群KubeConfig的下发情况,您可以调用ListUserKubeConfigStates接口来获取当前用户所有集群的KubeConfig状态列表

HTTP 方法:GET

protocol:HTTPS

url:/users/{Uid}/kubeconfig/states

语法

aliyun cs ListUserKubeConfigStates
    [--Uid <string>]
    [--page_number <int>]
    [--page_size <int>]
    [options]

参数

参数

类型

必填

说明

--Uid

String

否

阿里云账号内指定RAM用户或RAM角色ID

--page_number

Integer

否

当前页数。
取值范围:大于等于1。
默认值:1

--page_size

Integer

否

每页返回的结果数。
取值范围:1-100。
默认值:50

示例

aliyun cs GET /users/206945240368000000/kubeconfig/states --region cn-hangzhou --page_number 2 --page_size 10 --header "Content-Type=application/json"

MigrateCluster

命令描述

集群迁移

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/migrate

语法

aliyun cs MigrateCluster
    [--body <string>]
    --cluster_id <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--cluster_id

String

是

集群ID

示例

aliyun cs POST /clusters/c21e0591548ba4c10bdb535d6572b0000/migrate --region cn-hangzhou --header "Content-Type=application/json"

ModifyAutoRepairPolicy

命令描述

修改自愈规则

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/auto_repair_policies/{policy_id}

语法

aliyun cs ModifyAutoRepairPolicy
    [--body <string>]
    [--cluster_id <string>]
    [--policy_id <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--cluster_id

String

否

目标集群ID

--policy_id

String

否

自愈规则ID

示例

aliyun cs PUT /clusters/c68deb844dc6d480eb775be611fdf0000/auto_repair_policies/r-xxxxxx --region cn-hangzhou --header "Content-Type=application/json" --body '{"name":"test","rules":[{"repair_procedure":[{"name":"QuarantineGPU","intervention":{"enable":true,"inquiring_label":{"value":"inquiring","key":"k8s.aliyun.com/incident"},"type":"label","approved_label":{"value":"approved","key":"k8s.aliyun.com/incident"}},"config":{"key":"{\n\"drain_timeout\": \"30s\" \n}"}}],"incidents":[{"name":"Node.FaultNeedReboot.HOST","type":"system"}]}]}'

ModifyCluster

命令描述

您可以调用ModifyCluster接口修改ACK集群的配置

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/api/v2/clusters/{ClusterId}

语法

aliyun cs ModifyCluster
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs PUT /api/v2/clusters/cb95aa626a47740afbf6aa099b650000 --region cn-hangzhou --header "Content-Type=application/json"

ModifyClusterAddon

命令描述

您可以调用ModifyClusterAddon配置修改已安装的集群组件实例的配置。修改配置可能会影响业务,请评估影响后在业务低峰期操作并提前做好相关的数据备份

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/components/{component_id}/config

语法

aliyun cs ModifyClusterAddon
    [--body <string>]
    --cluster_id <string>
    --component_id <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

组件配置

--cluster_id

String

是

集群ID

--component_id

String

是

组件ID

示例

aliyun cs POST /clusters/c71d616e629ff40d5b42d7bb877700000/components/coredns/config --region cn-hangzhou --header "Content-Type=application/json"

ModifyClusterNodePool

命令描述

您可以根据节点池ID,调用ModifyClusterNodePool接口更新目标节点池的配置

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodepools/{NodepoolId}

语法

aliyun cs ModifyClusterNodePool
    --ClusterId <string>
    --NodepoolId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--body

String

否

请求体参数

示例

aliyun cs PUT /clusters/c23421cfa74454bc8b37163fd19af0000/nodepools/p31da1b38983f4511b490fc62108a0000 --region cn-hangzhou --header "Content-Type=application/json"

ModifyClusterTags

命令描述

您可以为集群添加标签键值对,让集群开发或运维人员能够更灵活地对集群进行分类管理,更好的支持监控、成本分析、租户隔离等需求。您可以调用ModifyClusterTags接口,修改集群标签

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/tags

语法

aliyun cs ModifyClusterTags
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

修改数据

示例

aliyun cs POST /clusters/c106f377e16f34eb1808d6b9362c90000/tags --region cn-hangzhou --header "Content-Type=application/json"

ModifyNodePoolNodeConfig

命令描述

您可以调用ModifyNodePoolNodeConfig接口修改集群节点池中节点配置信息,例如kubelet配置、节点轮转配置等。修改节点配置会按批次变更节点配置并重启kubelet, 可能会对节点运行和工作负载运行产生一定影响,请在业务低峰期操作

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodepools/{NodepoolId}/node_config

语法

aliyun cs ModifyNodePoolNodeConfig
    --ClusterId <string>
    --NodepoolId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--body

String

否

请求体

示例

aliyun cs PUT /clusters/c23421cfa74454bc8b37163fd19af0000/nodepools/np8d8c9c2cd0f64e89884f82a5fbcd0000/node_config --region cn-hangzhou --header "Content-Type=application/json"

ModifyPolicyInstance

命令描述

您可以调用ModifyPolicyInstance接口,在指定集群中更新策略规则实例,调整策略实例的治理动作(告警或拦截)、作用的命名空间范围等

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/policies/{policy_name}

语法

aliyun cs ModifyPolicyInstance
    [--body <object>]
    --cluster_id <string>
    --policy_name <string>
    [options]

参数

参数

类型

必填

说明

--body

Object

否

请求参数

--cluster_id

String

是

目标集群ID

--policy_name

String

是

策略治理规则名称

示例

aliyun cs PUT /clusters/c8155823d057948c69a0000/policies/ACKAllowedRepos --region cn-hangzhou --header "Content-Type=application/json"

OpenAckService

命令描述

首次使用容器服务Kubernetes版(Alibaba Cloud Container Service for Kubernetes,简称容器服务ACK)时,您需要调用OpenAckService接口开通服务

HTTP 方法:POST

protocol:HTTPS

url:/service/open

语法

aliyun cs OpenAckService
    [--type <string>]
    [options]

参数

参数

类型

必填

说明

--type

String

否

待开通的服务类型。可选值:
propayasgo:容器服务Kubernetes版(包括ACK托管集群和ACK专有集群)、容器服务Serverless版、注册集群。
edgepayasgo:容器服务Edge版

示例

aliyun cs POST /service/open --region cn-hangzhou --type propayasgo --header "Content-Type=application/json"

PauseClusterUpgrade

命令描述

暂停用户集群升级

已弃用:true

HTTP 方法:POST

protocol:HTTPS

url:/api/v2/clusters/{ClusterId}/upgrade/pause

语法

aliyun cs PauseClusterUpgrade
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs POST /api/v2/clusters/c82e6987e2961451182edacd74faf0000/upgrade/pause --region cn-hangzhou --header "Content-Type=application/json"

PauseComponentUpgrade

命令描述

调用PauseComponentUpgrade暂停组件升级

已弃用:true

HTTP 方法:POST

protocol:HTTPS

url:/clusters/{clusterid}/components/{componentid}/pause

语法

aliyun cs PauseComponentUpgrade
    --clusterid <string>
    --componentid <string>
    [options]

参数

参数

类型

必填

说明

--clusterid

String

是

集群ID

--componentid

String

是

组件ID

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/components/metric-server/pause --region cn-hangzhou --header "Content-Type=application/json"

PauseTask

命令描述

您可以调用PauseTask接口,暂停执行中的集群任务

HTTP 方法:POST

protocol:HTTPS

url:/tasks/{task_id}/pause

语法

aliyun cs PauseTask
    --task_id <string>
    [options]

参数

参数

类型

必填

说明

--task_id

String

是

任务ID

示例

aliyun cs POST /tasks/T-62a944794ee1410744000000/pause --region cn-hangzhou --header "Content-Type=application/json"

RemoveNodePoolNodes

命令描述

当您不再需要集群节点继续工作时,可以调用RemoveNodePoolNodes接口将集群中的节点移出节点池,并同时调整期望节点数。移除节点时,您可以选择是否同时释放ECS、是否自动排空节点。移除节点会涉及Pod迁移,可能会影响业务,请在业务低峰期操作并提前做好相关的数据备份

HTTP 方法:DELETE

protocol:HTTPS

url:/clusters/{ClusterId}/nodepools/{NodepoolId}/nodes

语法

aliyun cs RemoveNodePoolNodes
    --ClusterId <string>
    --NodepoolId <string>
    [--concurrency <bool>]
    [--drain_node <bool>]
    [--instance_ids <array>]
    [--nodes <array>]
    [--release_node <bool>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--concurrency

Boolean

否

是否并发移除。
true:节点将并发从伸缩组中被移除。
false:节点将顺序从伸缩组中被移除。
默认值:false


--drain_node

Boolean

否

是否排水节点。可选值:
true:排水。
false:不排水

--instance_ids

List

否

待移除的实例列表

--nodes

List

否

【该参数已废弃】
移除节点列表。
<danger>该参数已废弃,请使用instance_ids代替。</danger>

--release_node

Boolean

否

是否释放节点。可选值:
true:释放。
false:不释放。
移除节点不会自动释放包年包月的节点。如需释放包年包月的节点,请参见包年包月转按量付费将包年包月的节点转换为按量付费的节点 (https://help.aliyun.com/zh/ecs/change-the-billing-method-of-an-instance-from-subscription-to-pay-as-you-go-1?spm=a2c4g.11174283.help-menu-search-25365.d_3),再登录ECS管理控制台完成释放


示例

aliyun cs DELETE /clusters/c23421cfa74454bc8b37163fd19af0000/nodepools/np97de2cfb1ba042398dd8f5504c940000/nodes --region cn-hangzhou --header "Content-Type=application/json"

RepairClusterNodePool

命令描述

修复集群节点池

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/repair

语法

aliyun cs RepairClusterNodePool
    [--body <string>]
    --cluster_id <string>
    --nodepool_id <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体

--cluster_id

String

是

集群ID

--nodepool_id

String

是

节点池ID

示例

aliyun cs POST /clusters/c2273b7f4a30d4ef6b43e0926cd000000/nodepools/np613940c3593c4bea96faa8600c000000/repair --region cn-hangzhou --header "Content-Type=application/json"

ResumeComponentUpgrade

命令描述

调用ResumeComponentUpgrade重新启动被暂停的组件升级任务

已弃用:true

HTTP 方法:POST

protocol:HTTPS

url:/clusters/{clusterid}/components/{componentid}/resume

语法

aliyun cs ResumeComponentUpgrade
    --clusterid <string>
    --componentid <string>
    [options]

参数

参数

类型

必填

说明

--clusterid

String

是

集群ID

--componentid

String

是

组件ID

示例

aliyun cs POST /clusters/c5b5e80b0b64a4bf6939d2d8fbbc50000/components/metric-server/resume --region cn-hangzhou --header "Content-Type=application/json"

ResumeTask

命令描述

您可以调用ResumeTask接口,恢复已暂停的集群任务

HTTP 方法:POST

protocol:HTTPS

url:/tasks/{task_id}/resume

语法

aliyun cs ResumeTask
    --task_id <string>
    [options]

参数

参数

类型

必填

说明

--task_id

String

是

任务ID

示例

aliyun cs POST /tasks/T-62a944794ee1410744000000/resume --region cn-hangzhou --header "Content-Type=application/json"

ResumeUpgradeCluster

命令描述

根据集群ID,恢复升级处于升级暂停状态的集群

已弃用:true

HTTP 方法:POST

protocol:HTTPS

url:/api/v2/clusters/{ClusterId}/upgrade/resume

语法

aliyun cs ResumeUpgradeCluster
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs POST /api/v2/clusters/c82e6987e2961451182edacd74faf0000/upgrade/resume --region cn-hangzhou --header "Content-Type=application/json"

RevokeK8sClusterKubeConfig

命令描述

如果您希望吊销当前登录的阿里云账号/RAM用户所拥有的集群KubeConfig凭证,您可以调用RevokeK8sClusterKubeConfig接口进行吊销。吊销成功后,集群会生成新的KubeConfig,原来的KubeConfig会失效

HTTP 方法:DELETE

protocol:HTTPS

url:/k8s/{ClusterId}/certs

语法

aliyun cs RevokeK8sClusterKubeConfig
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs DELETE /k8s/c5b5e80b0b64a4bf6939d2d8fbbc50000/certs --region cn-hangzhou --header "Content-Type=application/json"

RunClusterCheck

命令描述

容器智能运维平台提供丰富的Kubernetes集群检查能力,包括集群升级检查、集群迁移检查、组件安装检查、组件升级检查、节点池检查等。在正式执行升级、迁移或安装操作前,容器智能运维平台会自动触发检查,仅当检查通过后您才可以执行变更操作。您也可以手动调用RunClusterCheck接口执行集群检查。建议您定期对集群进行检查和维护,预防集群安全风险

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/checks

语法

aliyun cs RunClusterCheck
    [--body <string>]
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体

--cluster_id

String

否

集群ID

示例

aliyun cs POST /clusters/ce0da5a1d627e4e9e9f96cae8ad000000/checks --region cn-hangzhou --header "Content-Type=application/json" --body '{"type":"NodePoolUpgrade"}'

RunClusterInspect

命令描述

发起集群巡检,创建巡检报告

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterId}/inspectReports

语法

aliyun cs RunClusterInspect
    [--body <string>]
    --clusterId <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--clusterId

String

是

集群ID

示例

aliyun cs POST /clusters/c82e6987e2961451182edacd74faf0000/inspectReports --region cn-hangzhou --header "Content-Type=application/json"

RunNodeOperation

命令描述

执行节点上的运维操作

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterId}/nodepools/{nodepoolId}/nodes/{nodeName}/operation

语法

aliyun cs RunNodeOperation
    [--body <string>]
    --clusterId <string>
    --nodeName <string>
    --nodepoolId <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体

--clusterId

String

是

集群ID

--nodeName

String

是

执行运维操作的节点

--nodepoolId

String

是

节点池ID

示例

aliyun cs POST /clusters/c2230fxxxxx/nodepools/npe76bc164769844b0000/nodes/cn-hangzhou.192.168.0.1/operation --region cn-hangzhou --header "Content-Type=application/json" --body '{"operationAction":"restart.kubelet"}'

ScaleClusterNodePool

命令描述

您可以调用ScaleClusterNodePool对节点进行扩容,以保证节点数量足够支撑业务运行

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodepools/{NodepoolId}

语法

aliyun cs ScaleClusterNodePool
    --ClusterId <string>
    --NodepoolId <string>
    [--body <object>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--body

Object

否

请求体参数

示例

aliyun cs POST /clusters/c23421cfa74454bc8b37163fd19af0000/nodepools/np31da1b38983f4511b490fc62108a0000 --region cn-hangzhou --header "Content-Type=application/json"

ScanClusterVuls

命令描述

您可以调用ScanClusterVuls接口扫描ACK集群中潜在的安全漏洞,包括容器工作负载漏洞、三方软件漏洞、CVE漏洞、WebCMS漏洞、Windows操作系统漏洞等。建议您定期扫描集群的安全漏洞,提高集群安全性

HTTP 方法:POST

protocol:HTTPS

url:/clusters/{cluster_id}/vuls/scan

语法

aliyun cs ScanClusterVuls
    [--cluster_id <string>]
    [options]

参数

参数

类型

必填

说明

--cluster_id

String

否

集群ID

示例

aliyun cs POST /clusters/c259f563386444ebb8d70000/vuls/scan --region cn-hangzhou --header "Content-Type=application/json"

StartAlert

命令描述

启动指定的报警规则

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/alert/{ClusterId}/alert_rule/start

语法

aliyun cs StartAlert
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID。您可以通过调用ListClusters获取集群ID

--body

String

否

请求体参数

示例

aliyun cs POST /alert/c245ff43c717f490000/alert_rule/start --region cn-hangzhou --header "Content-Type=application/json"

StopAlert

命令描述

停止ACK报警中心中报警规则,停止整个报警规则集分组、单个报警规则

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/alert/{ClusterId}/alert_rule/stop

语法

aliyun cs StopAlert
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID。
您可以通过调用https://help.aliyun.com/document_detail/87116.html获取集群ID

--body

String

否

请求参数

示例

aliyun cs POST /alert/c7f9c85baee73452883b3299a01070000/alert_rule/stop --region cn-hangzhou --header "Content-Type=application/json"

SyncClusterNodePool

命令描述

您可以调用SyncClusterNodePool接口同步集群节点池,包含节点池元数据、节点池内节点信息等

HTTP 方法:POST

protocol:HTTPS

url:/clusters/{ClusterId}/sync_nodepools

语法

aliyun cs SyncClusterNodePool
    --ClusterId <string>
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

示例

aliyun cs POST /clusters/c905d1364c2dd4b6284a3f41790c40000/sync_nodepools --region cn-hangzhou --header "Content-Type=application/json"

TagResources

命令描述

您可以为集群添加标签键值对,让集群开发或运维人员能够更灵活地对集群进行分类管理,更好的支持监控、成本分析、租户隔离等需求。您可以调用TagResources接口,为集群绑定标签

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/tags

语法

aliyun cs TagResources
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

示例

aliyun cs PUT /tags --region cn-hangzhou --header "Content-Type=application/json" --body '{"resource_type":"CLUSTER","region_id":"cn-hangzhou","resource_ids":["c1a7bb282fc0d48b****"],"tags":[{"value":"prod","key":"env"}]}'

UnInstallClusterAddons

命令描述

当您无需使用集群某些组件时,您可以调用UnInstallClusterAddons接口指定组件名称,删除组件,并选择是否删除关联的阿里云云资源

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/components/uninstall

语法

aliyun cs UnInstallClusterAddons
    --ClusterId <string>
    [--addons <array>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--addons

List

否

组件列表

示例

aliyun cs POST /clusters/c5b5e80b0b64a4bf6939d2d8fbbc50000/components/uninstall --region cn-hangzhou --header "Content-Type=application/json"

UntagResources

命令描述

当您无需使用集群的标签键值对时,您可以调用UntagResources接口,删除资源标签

HTTP 方法:DELETE

protocol:HTTPS

url:/tags

语法

aliyun cs UntagResources
    [--all <bool>]
    --region_id <string>
    --resource_ids <array>
    --resource_type <string>
    --tag_keys <array>
    [options]

参数

参数

类型

必填

说明

--all

Boolean

否

是否删除全部自定义标签,仅当tag_keys为空时生效。取值范围:
true: 删除全部标签。
false: 不删除全部标签

--region_id

String

是

资源所属的地域ID

--resource_ids

List

是

资源ID列表。最多支持添加50个资源ID

--resource_type

String

是

资源类型。
CLUSTER:集群

--tag_keys

List

是

资源的标签键列表。最多支持添加20个资源的标签键

示例

aliyun cs DELETE /tags --region cn-hangzhou --region_id 'cn-hangzhou' --resource_type CLUSTER --resource_ids '["c1a7bb282fc0d48b593***"]' --tag_keys '["TestKey1"]' --header "Content-Type=application/json"

UpdateClusterAuditLogConfig

命令描述

当您需要记录对Kubernetes API的请求以及请求结果来用于追溯集群操作历史、排查集群故障时,您可以调用UpdateClusterAuditLogConfig接口来开启、关闭指定ACK集群的审计日志功能、更新审计日志配置

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterid}/audit_log

语法

aliyun cs UpdateClusterAuditLogConfig
    [--body <string>]
    [--clusterid <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求结构体

--clusterid

String

否

集群ID

示例

aliyun cs PUT /clusters/c82e6987e2961451182edacd74faf0000/audit_log --region cn-hangzhou --header "Content-Type=application/json" --body '{"sls_project_name":"k8s-log-c82e6987e2961451182edacd74faf****","disable":false}'

UpdateClusterInspectConfig

命令描述

更新集群巡检配置

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterId}/inspectConfig

语法

aliyun cs UpdateClusterInspectConfig
    [--body <string>]
    --clusterId <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体

--clusterId

String

是

集群ID

示例

aliyun cs PUT /clusters/c82e6987e2961451182edacd74faf0000/inspectConfig --region cn-hangzhou --header "Content-Type=application/json"

UpdateContactGroupForAlert

命令描述

您可以调用UpdateContactGroupForAlert接口,为ACK集群中的报警规则集设置指定的联系人分组

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/alert/{ClusterId}/alert_rule/contact_groups

语法

aliyun cs UpdateContactGroupForAlert
    [--ClusterId <string>]
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

否

集群ID,可以调用ListCluster接口获取

--body

String

否

请求体参数

示例

aliyun cs POST /alert/ce7d08276f8a6422282c46272a84bxxxx/alert_rule/contact_groups --region cn-hangzhou --header "Content-Type=application/json" --body '{"cr_name":"sample","contact_group_ids":[12345],"namespace":"default","alert_rule_group_name":"sample"}'

UpdateControlPlaneLog

命令描述

ACK托管集群支持收集控制面组件日志并投递到您的SLS Log Project中。控制面组件包括Kube API Server、Kube Scheduler、Kube Controller Manager、Cloud Controller Manager等核心组件。您可以调用UpdateControlPlaneLog接口,修改控制面组件日志配置,例如日志保存时间、采集的组件等

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/controlplanelog

语法

aliyun cs UpdateControlPlaneLog
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求Body参数

示例

aliyun cs PUT /clusters/c5b5e80b0b64a4bf6939d2d8fbbc50000/controlplanelog --region cn-hangzhou --header "Content-Type=application/json"

UpdateK8sClusterUserConfigExpire

命令描述

ACK集群下发的KubeConfig过期时间默认为3年。您可以使用阿里云账号(主账号)自定义配置,调用UpdateK8sClusterUserConfigExpire接口指定RAM用户或角色在ACK集群中下发的KubeConfig的过期时间(1~876000小时)

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/k8s/{ClusterId}/user_config/expire

语法

aliyun cs UpdateK8sClusterUserConfigExpire
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs POST /k8s/c5b5e80b0b64a4bf6939d2d8fbbc50000/user_config/expire --region cn-hangzhou --header "Content-Type=application/json" --body '{"expire_hour":720,"user":"206945240368******"}'

UpdateKMSEncryption

命令描述

根据集群 ID,更新指定集群的 Secret 落盘加密功能配置

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/kms

语法

aliyun cs UpdateKMSEncryption
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs PUT /clusters/c4fe1e3a721544000/kms --region cn-hangzhou --header "Content-Type=application/json"

UpdateNodePoolComponent

命令描述

更新节点组件

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{clusterId}/nodepools/{nodepoolId}/component

语法

aliyun cs UpdateNodePoolComponent
    [--body <string>]
    [--clusterId <string>]
    [--nodepoolId <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求Body参数

--clusterId

String

否

集群ID

--nodepoolId

String

否

节点池ID

示例

aliyun cs PUT /clusters/c82e6987e2961451182edacd74faf0000/nodepools/np7c4fa4a5f1ce412b849670890000/component --region cn-hangzhou --header "Content-Type=application/json" --body '{"name":"kubelet","disableRolling":true,"rollingPolicy":{"maxFailedNodes":0,"maxParallelism":1,"batchInterval":0,"pausePolicy":"NotPause"},"version":"1.28.9-aliyun.1","config":{"customConfig":{"cpuManagerPolicy":"static"},"envs":[{"name":"LOG_LEVEL","value":"info"}]},"nodeNames":["cn-hangzhou.10.91.xx.xx"]}'

UpdateNodePoolComponentInstance

命令描述

更新节点组件

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{cluster_id}/nodepools/{nodepool_id}/component_instances/{name}

语法

aliyun cs UpdateNodePoolComponentInstance
    [--body <string>]
    --cluster_id <string>
    --name <string>
    --nodepool_id <string>
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--cluster_id

String

是

集群ID

--name

String

是

组件名称

--nodepool_id

String

是

节点池ID

示例

aliyun cs PUT /clusters/c2230fxxxxx/nodepools/np8d8c9c2cd0f64e89884f82a5fbcd0000/component_instances/kubelet --region cn-hangzhou --header "Content-Type=application/json"

UpdateResourcesDeleteProtection

命令描述

更新指定资源的删除保护状态,当前支持的资源类型有命名空间和服务。
通过本接口,您可以为涉及关键业务、敏感数据的命名空间或服务开启删除保护功能,以避免误删除带来的维护成本

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/resources/protection

语法

aliyun cs UpdateResourcesDeleteProtection
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

资源所属的集群ID

--body

String

否

待更新的目标资源

示例

aliyun cs PUT /clusters/c850429a2287b4d968e27e87a49210000/resources/protection --region cn-hangzhou --header "Content-Type=application/json"

UpdateTemplate

命令描述

编排模板是对一组Kubernetes集群资源的定义和描述,以声明性方式描述应用应该如何运行或者配置。您可以调用UpdateTemplate接口更新编排模板配置

contentType:application/json

HTTP 方法:PUT

protocol:HTTPS

requestBodyType:json

url:/templates/{TemplateId}

语法

aliyun cs UpdateTemplate
    --TemplateId <string>
    [--body <object>]
    [options]

参数

参数

类型

必填

说明

--TemplateId

String

是

模板ID

--body

Object

否

请求体参数

示例

aliyun cs PUT /templates/72d20cf8-a533-4ea9-a10d-e7630d000000 --region cn-hangzhou --header "Content-Type=application/json"

UpdateUserPermissions

命令描述

在ACK集群中,非集群创建者、RAM用户以及RAM角色在集群中默认没有任何RBAC权限。您可以调用UpdateUserPermissions接口,更新RAM用户或角色拥有的RBAC访问权限,包括可访问的资源、权限的作用范围、预置的角色类型等,从而更好地管理集群的安全访问控制

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/permissions/users/{uid}/update

语法

aliyun cs UpdateUserPermissions
    [--body <string>]
    [--mode <string>]
    [--uid <string>]
    [options]

参数

参数

类型

必填

说明

--body

String

否

请求体参数

--mode

String

否

授权方式,取值:
apply:全量更新权限,全量更新RAM用户或RAM角色集群授权信息操作会覆盖目标RAM用户或RAM角色已有的集群权限,请求时需要包含想要授权给目标RAM用户或RAM角色的所有权限配置。
delete: 删除权限,只会删除请求时包含的集群授权信息,不影响RAM用户或RAM角色的其他集群权限。
patch: 新增权限,只会新增请求时包含的集群授权信息,不影响RAM用户或RAM角色的其他集群权限。
默认值:apply



--uid

String

否

RAM用户或RAM角色的ID

示例

aliyun cs POST /permissions/users/23670000/update --region cn-hangzhou --header "Content-Type=application/json" --body '[{"role_name":"ops","cluster":"c796c60***","role_type":"cluster","namespace":"test","is_custom":false,"is_ram_role":false}]'

UpgradeCluster

命令描述

为避免过期版本集群潜在的安全和稳定性风险,同时享用新集群版本的新功能,请随ACK集群的版本发布节奏升级集群。您可以调用UpgradeCluster接口手动升级集群

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/api/v2/clusters/{ClusterId}/upgrade

语法

aliyun cs UpgradeCluster
    --ClusterId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

String

否

请求体参数

示例

aliyun cs POST /api/v2/clusters/c82e6987e2961451182edacd74faf0000/upgrade --region cn-hangzhou --header "Content-Type=application/json"

UpgradeClusterAddons

命令描述

您可以调用UpgradeClusterAddons接口升级集群组件实例的版本,从而享受新版本带来的功能优化体验

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/components/upgrade

语法

aliyun cs UpgradeClusterAddons
    --ClusterId <string>
    [--body <array>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--body

List

否

请求参数

示例

aliyun cs POST /clusters/cf4299b79b3e34226abfdc80a4bda0000/components/upgrade --region cn-hangzhou --header "Content-Type=application/json" --body '[{"component_name":"coredns","next_version":"v1.11.3.5-5321daf49-aliyun"}]'

UpgradeClusterNodepool

命令描述

您可以调用UpgradeClusterNodepool接口升级指定集群节点池的kubelet版本(建议与控制面版本一致)、操作系统版本或容器运行时版本

contentType:application/json

HTTP 方法:POST

protocol:HTTPS

requestBodyType:json

url:/clusters/{ClusterId}/nodepools/{NodepoolId}/upgrade

语法

aliyun cs UpgradeClusterNodepool
    --ClusterId <string>
    --NodepoolId <string>
    [--body <string>]
    [options]

参数

参数

类型

必填

说明

--ClusterId

String

是

集群ID

--NodepoolId

String

是

节点池ID

--body

String

否

请求参数

示例

aliyun cs POST /clusters/c106f377e16f34eb1808d6b9362c90000/nodepools/np31da1b38983f4511b490fc62108a0000/upgrade --region cn-hangzhou --header "Content-Type=application/json"

全局选项

以下为 CLI 通用选项,各选项的适用范围以说明为准。

选项

说明

--cli-dry-run

使用 --cli-dry-run 在执行校验后以人类可读格式输出请求详情,跳过实际运行

--cli-output

设置宿主 CLI Help 和本地错误的输出格式(json)

--cli-query

使用 --cli-query <jmespath> 通过 JMESPath 表达式过滤输出结果

--language

使用 --language [en|zh] 来指定语言

--output -o

使用 --output cols=Field1,Field1 [rows=jmesPath] 使用表格方式打印输出

--profile -p

使用 --profile <profileName> 指定操作的配置集

--region

使用 --region <regionId> 来指定访问大区

--version --api-version

使用 --version <YYYY-MM-DD> 来指定访问的API版本

--yes -y

跳过安全策略的确认提示(用于非交互式/Agent 场景)