DeployK8sApplication_企业级分布式应用服务_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

流控信息

当前云产品API请求速率暂未透出。

授权信息

如下是此API对应的授权信息,用于RAM权限策略语句的Action元素中,为RAM用户或RAM角色授予调用此API的权限。请通过 RAM 访问控制设置,使用方法可参考访问控制帮助文档

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
edas:ManageApplication
Update
Application
acs:edas:{#regionId}:{#accountId}:namespace/{#NameSpaceId}/application/{#AppId}

请求语法

POST /pop/v5/k8s/acs/k8s_apps HTTP/1.1

请求参数

字段名称字段详情
PreStopstring

停止前执行脚本,示例格式:{"tcpSocket":{"host":"", "port":8080}}展开详情

示例值:{ "exec":{ "command":[ "ls", "/" ] } }
Envsstring

部署环境变量,格式需要符合 JSON 对象数组。支持三种类型的环境变量,分别是普通环境变量,K8s ConfigMap 环境变量,K8s Secret 环境变量。普通环境变量格式如下所示:展开详情

示例值:[{"name":"x1","value":"y1"},{"name":"x2","valueFrom":{"configMapKeyRef":{"name":"my-config","key":"y2"}}},{"name":"x3","valueFrom":{"secretKeyRef":{"name":"my-secret","key":"y3"}}}]
ImageTagstring

镜像 Tag。

示例值:latest
BatchWaitTimeinteger<int32>

Pod 分批发布的最小间隔时间,详细信息请参见 minReadySeconds

示例值:0
Commandstring

容器启动命令。展开详情

示例值:ls
AppIdstring

应用 ID,可通过调用 ListApplication 接口获取,详情请参见 ListApplication

示例值:e83acea6-****-47e1-96ae-c0e953772cdc
PostStartstring

启动后执行脚本,格式如:{"exec":{"command":\["cat","/etc/group"\]}}。如果设置为{}表示删除,不设置表示忽略。

示例值:{ "exec":{ "command":[ "ls", "/" ] } }
Readinessstring

容器业务状态检查,如果检查失败,经过 K8s service 的流量将不转入到该容器,格式如:{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": \[{"name": "test","value": "testvalue"}\]}}。如果设置为""或者{}表示删除,不设置表示忽略。

示例值:{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": [{"name": "test","value": "testvalue"}]}}
Livenessstring

容器存活状态监测,格式如{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}。如果设置为""或者{}表示删除,不设置表示忽略。

示例值:{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}
Argsstring

容器启动 Args 命令参数,格式必须符合 JSON 数组\["参数 1","参数 2"\],其中 key 固定为字符串,清空需设置为空 JSON 数组"\[\]"

示例值:["args1","args2"]
Replicasinteger<int32>

应用实例数,最小为 0。

示例值:1
Imagestring

镜像完整 URL,覆盖镜像 Tag 参数。

示例值:registry-vpc.cn-beijing.aliyuncs.com/t****/app:v1
CpuLimitinteger<int32>

应用运行过程中,应用实例的 CPU 限制。 单位:核数,设置为 0 表示不限制。

示例值:1
MemoryLimitinteger<int32>

应用运行过程中,应用实例的内存限制。单位:MB,设置为 0 表示不限制。

示例值:0
CpuRequestinteger<int32>

应用运行过程中,应用实例需要申请的 CPU 配额,推荐设置。展开详情

示例值:0
MemoryRequestinteger<int32>

应用运行过程中,应用实例需要申请的内存配额,推荐设置。单位:MB。设置为 0 表示不申请。展开详情

示例值:0
NasIdstring

挂载的 NAS 的 ID,必须与集群在同一个地域。它必须有可用的挂载点创建额度,或者它的挂载点已经在 VPC 内的交换机上。如果不填,且存在 mountDescs 字段,则默认将自动购买一个 NAS 并挂载到 VPC 内的交换机上。

示例值:dfs23****
MountDescsstring

挂载配置描述,为一个序列化的 JSON。例如:\[{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}\]。其中,nasPath 是指文件储存路径;mountPath 是指挂载到容器内的路径。

示例值:[{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}]
StorageTypestring

NAS 存储类型,包括:展开详情

示例值:Performance
LocalVolumestring

宿主机文件挂载到容器内的配置。例如:\[{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}\]。其中,nodePath 为宿主机路径;mountPath 为容器内的路径;type 为挂载类型。

示例值:[{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}]
PackageUrlstring

部署包地址。通过 FatJar 或 WAR 包部署的应用需要配置部署包地址。展开详情

示例值:https://e***.oss-cn-beijing.aliyuncs.com/s***-1.0-SNAPSHOT-spring-boot.jar
PackageVersionstring

部署包的版本号,WAR 和 FatJar 类型必填。请自定义它的含义。展开详情

示例值:20200720参考取值来源:
    ListHistoryDeployVersion
JDKstring

部署的包依赖的 JDK 版本。可选的参数值为 Open JDK 7、Open JDK 8 或 Custom OpenJDK。镜像部署方式不支持此参数。当使用 Custom OpenJDK 时,还需配置 UserBaseImageUrl 字段。

示例值:Open JDK 8
WebContainerstring

部署包依赖的 Tomcat 版本。适用于通过 WAR 包部署的 Spring Cloud 和 Dubbo 应用,镜像不支持此参数。

示例值:apache-tomcat-7.0.91参考取值来源:
    GetWebContainerConfig
EdasContainerVersionstring

部署包依赖的 EDAS Container 版本。适用于通过 WAR 包部署的 HSF 应用,镜像不支持此参数。

示例值:3.5.9
UriEncodingstring

URI 编码方式,支持 ISO-8859-1、GBK、GB2312 和 UTF-8。展开详情

示例值:GBK
UseBodyEncodingboolean

useBodyEncodingForURI 是否启用。展开详情

示例值:false
UpdateStrategystring

分批发布策略展开详情

示例值:{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}
McpuRequestinteger<int32>

CPU 最小资源需求,单位:核数。设置为 0 表示不限制。展开详情

示例值:4
McpuLimitinteger<int32>

CPU 能使用的最大值,单位:核数。设置为 0 表示不做限制。

示例值:0
VolumesStrstring

数据卷。

示例值:test
PackageVersionIdstring

部署包版本 ID。

示例值:2bcc********
ChangeOrderDescstring

变更记录描述。

示例值:升级参考取值来源:
    ListRecentChangeOrder
    GetChangeOrderInfo
RuntimeClassNamestring

容器运行时类型:展开详情

示例值:runc
DeployAcrossZonesstring

是否将应用实例分布到多可用区。true 为是,其他值为否。

示例值:true
BatchTimeoutinteger<int32>

单批发布超时时间,单位:秒。

示例值:60
EnableAhasboolean

是否接入 AHAS。

示例值:true
WebContainerConfigstring

Tomcat 容器配置,设置为"""{}"表示删除配置:展开详情

示例值:{"useDefaultConfig":false,"contextInputType":"custom","contextPath":"hello","httpPort":8088,"maxThreads":400,"uriEncoding":"UTF-8","useBodyEncoding":true,"useAdvancedServerXml":false}参考取值来源:
    GetWebContainerConfig
JavaStartUpConfigstring

Java 启动参数用于在 Java 应用启动时配置启动参数。可配置:内存配置、应用、GC 策略、工具、服务注册和发现配置和自定义等配置,正确配置这些参数有助于降低垃圾回收(GC)开销,从而缩短服务器响应时间并提高吞吐量。参数格式为 JSON 字符串:original 为配置值,startup 为启动参数,系统将自动拼接所有的 startup 作为应用程序的 Java 启动参数。设置为"""{}"表示删除配置。

示例值:{"InitialHeapSize":{"original":512,"startup":"-Xms512m"},"MaxHeapSize":{"original":1024,"startup":"-Xmx1024m"}}参考取值来源:
    GetJavaStartUpConfig
SlsConfigsstring

Logstore 配置,设置为"""{}"表示删除配置:展开详情

示例值:[{"logstore":"thisisanotherfilelog","type":"file","logDir":"/var/log/*"},{"logstore":"","type":"stdout","logDir":"stdout.log"},{"logstore":"thisisafilelog","type":"file","logDir":"/tmp/log/*"}]
DeployAcrossNodesstring

是否将应用实例分布到多个节点。true 为是,其他值为否。

示例值:true
TrafficControlStrategystring

灰度发布流量控制策略。

示例值:{"http":{"rules":[{"conditionType":"percent","percent":10}]}}
PvcMountDescsstring

配置 K8s PVC(PersistentVolumeClaim)挂载,支持将 K8s PVC 卷挂载到指定的容器目录。PvcMountDescs 的配置参数说明如下:展开详情

示例值:[{"pvcName":"nas-pvc-1","mountPaths":[{"mountPath":"/usr/share/nginx/data"},{"mountPath":"/usr/share/nginx/html","readOnly":true}]}]
ConfigMountDescsstring

配置 K8s ConfigMap 和 Secret 挂载,支持将 ConfigMap 和 Secret 挂载到指定的容器目录。ConfigMountDescs 的配置参数说明如下:展开详情

示例值:[ { "name": "nginx-config", "type": "ConfigMap", "mountPath": "/etc/nginx" }, { "name": "tls-secret", "type": "Secret", "mountPath": "/etc/ssh" } ]
EnvFromsstring

配置 K8s EnvFrom 类型的环境变量,将指定的 ConfigMap 或 Secret 挂载到指定目录,每个 key 对应目录下的一个文件,文件的内容为该 key 对应的 value。展开详情

示例值:[{"name":"appname","valueFrom":{"configMapKeyRef":{"name":"appconf","key":"name"}}}]
EmptyDirsstring

配置 K8s emptyDir 挂载,支持将 emptyDir 卷挂载到指定的容器目录。EmptyDirs 的配置参数说明如下:展开详情

示例值:[{"mountPath":"/app-log","subPathExpr":"$(POD_IP)"},{"readOnly":true,"mountPath":"/etc/nginx"}]
CustomAffinitystring

Pod 亲和性配置,当且仅当 DeployAcrossNodes 与 DeployAcrossZones 都为 false 时生效。

示例值:{"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"beta.kubernetes.io/arch","operator":"NotIn","values":["arm64","arm32"]}]}]},"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":5,"preference":{"matchExpressions":[{"key":"kubernetes.io/os","operator":"In","values":["linux"]}]}}]},"podAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"namespaces":["default"],"topologyKey":"kubernetes.io/hostname","labelSelector":{"matchExpressions":[{"key":"edas.oam.acname","operator":"NotIn","values":["edas-test-app"]}]}}]},"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"namespaces":["default"],"topologyKey":"failure-domain.beta.kubernetes.io/zone","labelSelector":{"matchExpressions":[{"key":"edas.oam.acname","operator":"In","values":["edas-test-app-2"]}]}},"weight":15}]}}
CustomTolerationsstring

Pod 调度容忍配置,当且仅当 DeployAcrossNodes 与 DeployAcrossZones 都为 false 时生效。

示例值:[{"key":"edas-taint-key2","operator":"Exists","effect":"NoExecute","tolerationSeconds":50},{"key":"edas-taint-key","operator":"Equal","value":"edas-taint-value","effect":"PreferNoSchedule"}]
BuildPackIdstring

EDAS-Container 构建包号:展开详情

示例值:59
Annotationsstring

应用 Pod 注解。

示例值:{"annotation-name-1":"annotation-value-1","annotation-name-2":"annotation-value-2"}
Labelsstring

应用 Pod 标签。

示例值:{"label-name-1":"label-value-1","label-name-2":"label-value-2"}
EnableEmptyPushRejectboolean

是否开启推空保护:展开详情

示例值:false
EnableLosslessRuleboolean

是否启用无损上线规则:展开详情

示例值:true
LosslessRuleWarmupTimeinteger<int32>

服务预热时长,单位:秒。取值范围为 0~86400 秒。

示例值:120
LosslessRuleDelayTimeinteger<int32>

服务延迟注册时长,单位:秒。取值范围为 0~86400 秒。

示例值:0
LosslessRuleFuncTypeinteger<int32>

服务预热曲线。取值范围 0~20。默认为 2(适合于一般预热场景),表示在预热周期内服务提供者的流量接收曲线形状呈 2 次曲线形状。

示例值:2
LosslessRuleAlignedboolean

是否启用无损滚动发布模式配置通过就绪检查前完成服务注册:展开详情

示例值:false
LosslessRuleRelatedboolean

是否启用无损滚动发布模式配置通过就绪检查前完成服务预热:展开详情

示例值:false
LimitEphemeralStorageinteger<int32>

临时存储资源需求上限,单位:GB。设置 0 表示不限制。

示例值:4
RequestsEphemeralStorageinteger<int32>

临时存储最小资源需求,单位:GB。设置 0 表示不限制。

示例值:2
Sidecarsstring

为应用 Pod 设置 Sidecar 容器。支持设置容器配置的格式 YAML,其值为 Sidecar 容器 YAML 配置 base64 编码后的值。

示例值:[ { "yamlEncoded": "Y29tbWFuZDoKICAtIHRhaWwKICAtICctZicKICAtIC9kZXYvbnVsbAppbWFnZTogJ2J1c3lib3g6bGF0ZXN0JwpuYW1lOiBidXN5Ym94Cg==" } ]
InitContainersstring

为应用 Pod 设置初始化容器。支持设置容器配置的格式 YAML,其值为 Init 容器 YAML 配置 base64 编码后的值。

示例值:[ { "yamlEncoded": "Y29tbWFuZDoKICAtIHNsZWVwCiAgLSAnNjAnCmltYWdlOiAnYnVzeWJveDpsYXRlc3QnCm5hbWU6IGluaXQtYnVzeWJveAo=" } ]
UserBaseImageUrlstring

使用自定义 JDK 运行时,需要配置基础镜像地址。该地址需要可公开访问,EDAS 服务端会拉取该镜像,用于构建应用镜像。

示例值:openjdk:8u302
CanaryRuleIdstring

金丝雀规则策略 ID。

示例值:a8daf22e-****-968c7ff2ea34
TerminateGracePeriodinteger<int32>

设置应用优雅停止超时时间。单位:秒。

示例值:120
ImagePlatformsstring

镜像目标平台架构,当使用 war、jar 部署时有效,输入样例:展开详情

Startupstring

启动探针可以用于对慢启动容器进行存活性检测,避免它们在启动运行之前就被杀掉,格式如:{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": [{"name": "test","value": "testvalue"}]}}。展开详情

示例值:{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}
CustomAgentVersionstring

设置应用挂载的自定义 ArmsAgent 探针版本。展开详情

示例值:3.1.4

返回参数

字段名称字段详情
ChangeOrderIdstring

变更流程 ID,可调用 GetChangeOrderInfo 接口获取,详情请参见 GetChangeOrderInfo

示例值:cd65b247-****-475b-ad4b-7039040d625c
Codeinteger<int32>

接口状态或 POP 错误码。

示例值:200
Messagestring

附加信息 。

示例值:success
RequestIdstring

请求 ID。

示例值:a5281053-08e4-47a5-b2ab-5c0323de*****

返回示例

变更历史

变更时间变更内容概要操作
2024-01-30
新增请求参数CustomAgentVersion
2023-10-10
新增请求参数ImagePlatforms
新增请求参数Startup
2023-04-11
新增请求参数TerminateGracePeriod
2023-04-03
新增请求参数CanaryRuleId
2023-03-27
新增请求参数UserBaseImageUrl
2023-03-24
新增请求参数Sidecars
新增请求参数InitContainers
2022-10-18
新增请求参数LimitEphemeralStorage
新增请求参数RequestsEphemeralStorage
2022-01-27
新增请求参数Annotations
新增请求参数Labels
新增请求参数EnableEmptyPushReject
新增请求参数EnableLosslessRule
新增请求参数LosslessRuleWarmupTime
新增请求参数LosslessRuleDelayTime
新增请求参数LosslessRuleFuncType
新增请求参数LosslessRuleAligned
新增请求参数LosslessRuleRelated

相关示例

使用此样例可以变更EDAS K8S应用
2021-09-24
2024年08月20日