Deploys an application in a Container Service Kubernetes cluster or a serverless Kubernetes cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only the common request header. For more information, see Common request parameters.

Request syntax

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

Request parameters

Parameter Type Position Required Example Description
AppId String Query Yes e83acea6-****-47e1-96ae-c0e953772cdc

The ID of the application to be deployed. You can query the ID by calling the ListApplication operation. For more information, see ListApplication.

PreStop String Query No {\"exec\":{\"command\":[\"ls\",\"/\"]}}"

The pre-stop script. An example of the value is {"tcpSocket":{"host":"", "port":8080}}.

If this parameter is set to "" or {}, the previous configuration is deleted. If this parameter is not specified, the previous configuration is still used.

Envs String Query No [{"name":"x","value":"y"},{"name":"x2","value":"y2"}]

The environment variables used to deploy the application. Set this parameter to a JavaScript object notation (JSON) array in the format of

[{"name":"x","value":"y"},{"name":"x2","value":"y2"}], where the keys are set to name and value.

Note If you want to cancel this configuration, you must specify an empty JSON array in the format of [] to indicate no configuration.
ImageTag String Query No latest

The tag of the image.

BatchWaitTime Integer Query No 0

The minimum time interval for the phased release of pods. For more information, see minReadySeconds.

Command String Query No ls

The command used to start the container.

Note If you want to cancel this configuration, specify an empty string in the format of "" to indicate no configuration.
PostStart String Query No {\"exec\":{\"command\":[\"ls\",\"/\"]}}"

The post-start script. An example of the value is {"exec":{"command":["cat","/etc/group"]}}. If this parameter is set to "" or {}, the previous configuration is deleted. If this parameter is not specified, the previous configuration is still used.

Readiness String Query No {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": [{"name": "test","value": "testvalue"}]}}

The script used to check the service status of the container for the application. If the check fails, the traffic passing through the Kubernetes service is not transmitted to the container. Specify this parameter in the format of {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": [{"name": "test","value": "testvalue"}]}}. If this parameter is set to "" or {}, the previous configuration is deleted. If this parameter is not specified, the previous configuration is still used.

Liveness String Query No {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}

The script used to check the liveness of the container. Specify this parameter in the format of {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}. If this parameter is set to "" or {}, the previous configuration is deleted. If this parameter is not specified, the previous configuration is still used.

Args String Query No ["args1","args2"]

The argument array in the container start-up command. Set this parameter to a JSON array in the format of ["args1","args2"], where each key is set to a string. If you want to cancel this configuration, set this parameter to an empty JSON array in the format of [].

Replicas Integer Query No 1

The number of application instances. The minimum value is 0.

Image String Query No registry-vpc.cn-beijing.aliyuncs.com/t****/app:v1

The absolute URL of the image. This parameter setting overwrites the setting of the ImageTag parameter.

CpuLimit Integer Query No 1

The maximum number of CPU cores allowed for each application instance while the application is running. Unit: cores. To impose no limit, set this parameter to 0.

MemoryLimit Integer Query No 0

The maximum memory allowed for each application instance while the application is running. Unit: MB. To impose no limit, set this parameter to 0.

CpuRequest Integer Query No 0

The CPU quota requested for each application instance while the application is running. We recommend that you configure this parameter.

Unit: cores. To impose no limit, set this parameter to 0.

Note You must set this parameter together with the CpuLimit parameter. Make sure that the CpuRequest value is no greater than the CpuLimit value.
MemoryRequest Integer Query No 0

The memory quota requested for each application instance while the application is running. We recommend that you configure this parameter. Unit: MB. To not apply for a memory quota, set this parameter to 0.

Note You must set this parameter together with the MemoryLimit parameter. Make sure that the MemoryRequest value is no greater than the MemoryLimit value.
NasId String Query No dfs23****

The ID of the Apsara File Storage NAS file system mounted to the container where the application is running. The NAS file system must be in the same region as the cluster. The NAS file system must have an available mount target or have a mount target on the vSwitch in the virtual private cloud (VPC) where the application is located. If this parameter is not specified and the mountDescs field exists, a NAS file system is automatically purchased and mounted to the vSwitch in the VPC by default.

MountDescs String Query No [{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}]

The description of the NAS mounting configuration. Set this parameter to a serialized JSON string. For example, set this parameter to [{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}]. The nasPath field specifies the file storage path, and the mountPath field specifies the path for mounting the file system to the container.

StorageType String Query No Performance

Only SSD disks are supported.

LocalVolume String Query No [{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}]

The configuration for mounting host files to the container where the application is running. For example, set this parameter to [{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}]. The nodePath field specifies the host path, the mountPath field specifies the path in the container, and the type field specifies the mount type.

PackageUrl String Query No https://e***.oss-cn-beijing.aliyuncs.com/s***-1.0-SNAPSHOT-spring-boot.jar

The URL of the deployment package. This parameter is required if you use a FatJar or WAR package to deploy the application.

Note The version of EDAS POP API SDK for Java or Python must be 2.44.0 or later.
PackageVersion String Query No 20200720

The version number of the deployment package. This parameter is required if you use a FatJar or WAR package to deploy the application. You must customize a version number.

Note The version of EDAS POP API SDK for Java or Python must be 2.44.0 or later.
JDK String Query No Open JDK 8

The version of the Java Development Kit (JDK) on which the deployment package of the application depends. Open JDK 7 and Open JDK 8 are supported. This parameter is not supported if you use an image to deploy the application.

WebContainer String Query No apache-tomcat-7.0.91

The version of the Tomcat container on which the deployment package of the application depends. This parameter is applicable to Spring Cloud and Apache Dubbo applications that are deployed by using WAR packages. This parameter is not supported if you use an image to deploy the application.

EdasContainerVersion String Query No 3.5.9

The version of EDAS Container on which the deployment package of the application depends. This parameter is applicable to High-speed Service Framework (HSF) applications that are deployed by using WAR packages. This parameter is not supported if you use an image to deploy the application.

UriEncoding String Query No GBK

The uniform resource identifier (URI) encoding scheme. Valid values: ISO-8859-1, GBK, GB2312, and UTF-8.

Note If this parameter is not specified in the application configuration, the default URI encoding scheme in the Tomcat container is applied.
UseBodyEncoding Boolean Query No false

Specifies whether useBodyEncodingForURI is enabled.

Note If this parameter is not specified in the application configuration, the default value of false is applied.
UpdateStrategy String Query No {"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}

The phased release policy.

  • Example 1: 1 instance for canary release + 2 subsequent batches + automatic batching + 1-minute batch interval.{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}
  • Example 2: 1 instance for canary release + 2 subsequent batches + manual batching. {"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"manual"},"grayUpdate":{"gray":1}}
  • Example 3: 2 batches + automatic batching + 0-minute batch interval. {"type":"BatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":0}}
McpuRequest Integer Query No 4

The minimum number of CPU cores required. Unit: cores. To impose no limit, set this parameter to 0.

Note You must set this parameter together with the CpuLimit parameter. Make sure that the McpuRequest value is no greater than the CpuLimit value.
McpuLimit Integer Query No 0

The maximum number of CPU cores allowed. Unit: cores. To impose no limit, set this parameter to 0.

VolumesStr String Query No test

The data volume.

PackageVersionId String Query No 2bcc********

The version ID of the deployment package.

ChangeOrderDesc String Query No Upgrade

The description of the change record.

RuntimeClassName String Query No runc

The type of the container runtime. This parameter is applicable only to clusters that use sandboxed containers.

DeployAcrossZones String Query No true

Specifies whether to distribute application instances to multiple zones. The value of true indicates yes and other values indicate no.

BatchTimeout Integer Query No 60

The timeout period for a single batch. Unit: seconds.

EnableAhas Boolean Query No true

Specifies whether to enable access to Application High Availability Service (AHAS).

WebContainerConfig String Query No {"useDefaultConfig":false,"contextInputType":"custom","contextPath":"hello","httpPort":8088,"maxThreads":400,"uriEncoding":"UTF-8","useBodyEncoding":true,"useAdvancedServerXml":false}

The Tomcat container configuration. If this parameter is set to "" or "{}", the previous configuration is deleted. Valid values:

  • useDefaultConfig: specifies whether to use the custom configuration. The value of true indicates that the custom configuration is not used. The value of false indicates that the custom configuration is used. If the custom configuration is not used, the following parameters do not take effect.
  • contextInputType: specifies whether to customize the access path for the application.
    • war: If you select this option, the application access path is the name of the WAR package. You do not need to specify a custom path.
    • root: If you select this option, the application access path is /. You do not need to specify a custom path.
    • custom: If you select this option, you must specify a custom path for the contextPath parameter.
  • contextPath: specifies a custom path. This parameter is required only when the contextInputType parameter is set to custom.
  • httpPort: specifies a port number. The port number ranges from 1024 to 65535. Though the admin permissions are configured for the container, the root permissions are required to perform operations on ports whose number is less than 1024. Therefore, enter a value greater than 1024 within the valid range. Default value: 8080.
  • maxThreads: specifies the maximum number of connections in the connection pool. Default value: 400.
    Note This parameter greatly affects the application performance. We recommend that you set this parameter under professional guidance.
  • uriEncoding: specifies the encoding format for Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. Default value: ISO-8859-1.
  • useBodyEncoding: specifies whether to use BodyEncoding for URL.
  • useAdvancedServerXml: specifies whether to use advanced configurations to customize the server.xml file. If the preceding parameter types and specific parameters cannot meet your requirements, you can use advanced configurations to modify the server.xml file of Tomcat.
  • serverXml: customizes the content of the server.xml file in advanced configurations. This parameter takes effect only when useAdvancedServerXml is set to true.
JavaStartUpConfig String Query No {"InitialHeapSize":{"original":512,"startup":"-Xms512m"},"MaxHeapSize":{"original":1024,"startup":"-Xmx1024m"}}

This parameter is used to configure Java startup parameters when a Java application is started. The Java startup parameters involve the memory, application, garbage collection (GC) policy, tools, service registration and discovery, and custom configurations. Proper parameter settings help reduce the GC overhead, shorten the server response time, and improve the throughput. Set this parameter to a JSON string. In the example, original specifies the configuration value and startup specifies a startup parameter. The system automatically concatenates all startup values as the configuration of the Java startup parameters for the application. If this parameter is set to "" or "{}", the previous configuration is deleted.

SlsConfigs String Query No [{"logstore":"thisisanotherfilelog","type":"file","logDir":"/var/log/*"},{"logstore":"","type":"stdout","logDir":"stdout.log"},{"logstore":"thisisafilelog","type":"file","logDir":"/tmp/log/*"}]

The Logstore configuration. If this parameter is set to "" or "{}", the previous configuration is deleted. Valid values:

  • Configs:
    • type: the collection type. Set this parameter to file to specify the file type. Set this parameter to stdout to specify the standard output type.
    • Logstore: the name of the Logstore. Make sure that the name of the Logstore is unique in the cluster. The name must comply with the following rules:
      • The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
      • The name must start and end with a lowercase letter or a digit.
      • The name must be 3 to 63 characters in length. If this parameter is empty, the system automatically generates a name.
    • LogDir: If the standard output type is used, the collection path is stdout.log. If the file type is used, the collection path is the path of the collected file. Wildcards (*) are supported. The collection path must match the following regular expression: ^/(.+)/(.*)^/$.
DeployAcrossNodes String Query No true

Specifies whether to distribute application instances to multiple nodes. The value of true indicates yes and other values indicate no.

TrafficControlStrategy String Query No {"http":{"rules":[{"conditionType":"percent","percent":10}]}}

The traffic throttling policy for canary release.

Response parameters

Parameter Type Example Description
ChangeOrderId String cd65b247-****-475b-ad4b-7039040d625c

The ID of the change process. You can query the ID by calling the GetChangeOrderInfo operation. For more information, see GetChangeOrderInfo.

Code Integer 200

The HTTP status code.

Message String success

The additional information.

RequestId String a5281053-08e4-47a5-b2ab-5c0323de7b5a

The ID of the request.

Examples

Sample requests

POST /pop/v5/k8s/acs/k8s_apps HTTP/1.1
Common request parameters
{
"AppId": "e83acea6-****-47e1-96ae-c0e953772cdc"
}

Sample success responses

XML format

<RequestId>a5281053-08e4-47a5-b2ab-5c0323de7b5a</RequestId>
<Message>success</Message>
<ChangeOrderId>cd65b247-****-475b-ad4b-7039040d625c</ChangeOrderId>
<Code>200</Code>

JSON format

{
    "RequestId": "a5281053-08e4-47a5-b2ab-5c0323de7b5a",
    "Message": "success",
    "ChangeOrderId": "cd65b247-****-475b-ad4b-7039040d625c",
    "Code": 200
}

Error codes

For a list of error codes, visit the API Error Center.