You can call this operation to deploy an application in a container service Kubernetes cluster or 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 header

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

Request structure

POST /pop/v5/k8s/acs/k8s_apps HTTPS|HTTP

Request parameters

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

The ID of the application. You can obtain the ID by calling the ListApplication operation. For more information, see ListApplication.

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

Run the script before stopping the job. For example, {"tcpSocket":{"host":"", "port":8080}}.

" "or {} indicates deletion. Do not set means ignore

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

Deployment environment variables, whose format must be JSON.

[{"name":"x","value":"y",{"name":"x2","value":"y2"}]. The key is fixed as name and value.

Note To cancel the configuration, set an empty JSON Array "[]" to indicate that the configuration will not be performed.
ImageTag String No latest Image Version
BatchWaitTime Integer No 0

The minimum gap for batch release of pods. For more information, see minReadySeconds.

Command String No ls

The commands run by the container.

Note If you want to cancel the configuration, set an empty string. "" is not configured.
PostStart String No {\"exec\":{\"command\":[\"ls\",\"/\"]}}"

Run the script in the format of {"exec":{"command":["cat","/etc/group"]}}. If this parameter is set to "" or {}, the service is deleted. If this parameter is not set, the service is ignored.

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

The container business status check fails. If the check fails, traffic that passes through the K8s service is not transferred to the container. Syntax: {"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 service is deleted. If this parameter is not set, the service is ignored.

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

Container viability status monitoring. Format:{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}. If this parameter is set to "" or {}, the service is deleted. If this parameter is not set, the service is ignored.

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

Container startup Args command parameter, the format must conform to the JSON Array ["parameter 1","parameter 2"], where key is fixed as a string, empty must be set to an empty JSON Array "[]".

Replicas Integer No 1

The number of application instances. Minimum value: 0.

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

The complete URL of the image, overwriting the Tag parameter of the image.

CpuLimit Integer No 1

The CPU limit of application instances when the application is running. Unit: The number of cores. If it is set to 0, the number of cores is unlimited.

MemoryLimit Integer No 0

The memory limit of the application instance when the application is running. Unit: MB. If the value is set to 0, the quota is unlimited.

CpuRequest Integer No 0

We recommend that you apply for the CPU quota for an application instance when the application is running.

Unit: The number of cores. If it is set to 0, the number of cores is unlimited.

Note When you set this parameter, you must set the CpuLimit parameter and set it to a value smaller than CpuLimit.
MemoryRequest Integer No 0

We recommend that you apply for the memory quota for an application instance when the application is running. Unit: MB. The parameter value is set to 0, indicating that the certificate is not applied for.

Note When you set this parameter, you must set the MemoryLimit parameter and set it to a value smaller than or equal to the MemoryLimit parameter.
NasId String No dfs23****

The ID of the NAS file system to be mounted, which must be in the same region as the cluster. For a Mount target, a quota of available mount points is set, or its Mount point belongs to a vSwitch in the VPC. If you do not specify this parameter and the mountdess parameter is specified, the system automatically purchases a NAS file system and mounts the NAS file system to a vSwitch in the VPC.

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

The mount configuration description, which is a serialized JSON file. Example:[{"nasPath": "/k8s","mountPath": "/mnt",{"nasPath": "/files","mountPath": "/app/files"}]. nasPath indicates the path where files are stored. mountPath indicates the path where files are mounted in a container.

StorageType String No Performance

Currently only SSD is supported.

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

The configuration of mounting host files to the container where the application is running. Example:[{"type":"","nodePath":"/localfiles","mountPath":"/app/files" //,{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}]. Specifically, nodePath indicates the path of the host. mountPath indicates the path in the container. type indicates the mount type.

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

The address where the deployment package of the application is located. If you deploy an application through a FatJar or WAR package, you need to configure the deployment package address.

Note Java or Python SDK for EDAS POP API must be v2.44.0 or later.
PackageVersion String No 20200720

The version number of the deployment package. It is required for WAR and FatJar types. Please customize its meaning.

Note Java or Python SDK for EDAS POP API must be v2.44.0 or later.
JDK String No Open JDK 8

The JDK version on which the deployment package depends. Open JDK 7 and Open JDK 8 are supported. The error message returned because the specified image does not support this parameter.

WebContainer String No apache-tomcat-7.0.91

The version of Tomcat that the deployment package is dependent on. This method is applicable to Spring Cloud and Dubbo applications deployed with a WAR package. The image does not support this parameter.

EdasContainerVersion String No 3.5.9

The version of the EDAS Container on which the deployment package depends. An HSF application deployed with a WAR package. Images do not support this parameter.

UriEncoding String No GBK

The URI encoding method. Valid values: ISO-8859-1, GBK, GB2312, and UTF-8.

Note On the Application Configuration page, leave this parameter unspecified and use the Tomcat default value.
UseBodyEncoding Boolean No false

Indicates whether the useBodyEncodingForURI is enabled.

Note Use the default value false if you do not specify this parameter in application configuration.
UpdateStrategy String No {"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}

Batch release policy

  • Example 1: One phased-out machine + two subsequent batches + an automatic batch operation + a batch operation interval of 1 minute.{" type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}
  • Example 2: one ASW + two subsequent batches + manual batches.{" type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"manual"},"grayUpdate":{"gray":1}}
  • Example 3: This example is divided into two batches, an automatic batch, and a 0-minute interval.{" type":"BatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":0}}
McpuRequest Integer No 4

Minimum CPU resource requirements. Unit: number of cores. Set the parameter to 0, indicating that no restriction is applied.

Note When you set this parameter, you must set the CpuLimit parameter and set it to a value smaller than CpuLimit.
McpuLimit Integer No 0

The maximum number of CPU cores that can be processed. Unit: cores. If the value is set to 0, no limit is applied.

VolumesStr String No test

Data volumes.

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

The ID of the deployment package version.

ChangeOrderDesc String No Upgrade resource plans

The description of the change record.

RuntimeClassName String No runc

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

DeployAcrossZones String No true

Indicates whether to distribute the application instances to multiple zones. " true: Yes. Other values: No.

BatchTimeout Integer No 600

The timeout period for publishing a single cloth. Unit: seconds.

EnableAhas Boolean No true

Whether to connect to AHAS.

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

The Tomcat container configuration. Set the parameter to "" or "{}" to delete the configuration:

  • useDefaultConfig: indicates whether to use custom configuration. A value of true indicates that the custom configuration is not used. A value of false indicates that the custom configuration is used. If you do not use the custom configuration, the following parameter settings will not take effect:
  • contextInputType: Select the access path of the application.
    • war: The custom path is not required. The application access path is the WAR package name.
    • root: The custom path is not required. The application access path is /.
    • custom: enter a custom path in the custom path field.
  • contextPath: The custom path. This parameter is required only when the contextInputType is of the custom type.
  • httpPort: The Port range is 1024~65535. Ports smaller than 1024 need Root permissions to operate. Specify a port greater than 1024 because the container is configured with the Admin permission. If this parameter is not set, the default value 8080 is used.
  • maxThreads: configures the number of connections to the connection pool. The default size is 400.
    Note This configuration has a great impact on the application performance. Please configure it by professionals.
  • uriEncoding: the encoding format of a Tomcat API, including UTF-8, ISO-8859-1, GBK, and gb2312. If this parameter is not set, ISO-8859-1 is used by default.
  • useBodyEncoding: whether to use BodyEncoding for URL.
  • useAdvancedServerXml: choose whether to use advanced settings to customize the server.xml file. When the preceding parameter type and specific parameters do not meet your needs, you can select use advanced settings to edit the Server.xml file of Tomcat.
  • serverXml: the content of the server.xml text file customized in advanced configurations. This parameter takes effect only when the useAdvancedServerXml is true.
JavaStartUpConfig String No {"InitialHeapSize":{"original":512,"startup":"-Xms512m"},"MaxHeapSize":{"original":1024,"startup":"-Xmx1024m"}}

Java startup parameters are used to configure startup parameters when a Java application is started. Configurable: correct configuration of memory, applications, GC policies, tools, service registration and discovery, and custom configurations. These configurations can reduce garbage collection (GC) overhead and improve server response time and throughput. The value of the startup parameter is a JSON-formatted string. The original parameter indicates the specified parameter value, and the system automatically uses all startup parameters as the Java startup parameters of the application. "" Or "{}" indicates that the configuration is deleted.

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

The Logstore configuration. Set the parameter to "" or "{}" to delete the configuration:

  • Configs:
    • type: Collection type. Set the file type to file. Set the standard output type to stdout.
    • Logstore: the name of the logstore. Configure Logstore names in the same cluster as follows:
      • The Logstore name can only contain lowercase letters, digits, hyphens (-), and underscores (_).
      • The name must start and end with a lowercase letter or digit.
      • The project name must be 3 to 63 characters in length. If you do not set this parameter, the system will automatically generate the parameter.
    • LogDir: If the standard output type is set to stdout.log, the collection path is stdout.log. If the file type is set to file type, the file path is collected. You can specify wildcard characters. The collection path must be in the format of ^ /(. +) /(. *) ^/$.

Response parameters

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

The ID of the change process. You can call the GetChangeOrderInfo operation to obtain this ID. For more information, see GetChangeOrderInfo.

Code Integer 200

Interface status or POP error codes

Message String Success

Additional information

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

The ID of the API request.

Examples

Sample requests

POST /pop/v5/k8s/acs/k8s_apps HTTP/1.1
Common request headers
{
"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.