Creates 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 headers

This operation uses common request headers, but does not use special request headers. For more information, see Common parameters.

Request syntax

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

Request parameters

Parameter Type Position Required Example Description
AppName String Query Yes doc-test

The name of the application. The name must start with a letter and can contain digits, letters, and hyphens (-). It can be up to 36 characters in length.

ClusterId String Query Yes c9cd****

The cluster ID. You can query the cluster ID by calling the ListCluster operation. For more information, see ListCluster.

IntranetTargetPort Integer Query No 80

The backend port of the internal-facing Server Load Balancer (SLB) instance, which is also the service port of the application. Valid values: 1 to 65535.

IntranetSlbPort Integer Query No 80

The frontend port of the internal-facing SLB instance. Valid values: 1 to 65535.

ImageUrl String Query No registry.cn-beijing.aliyuncs.com/****_test/****-cons****:1.0

The image URL. When PackageType is set to Image, this parameter is required.

ApplicationDescription String Query No Application in the production environment

The description of the application.

RepoId String Query No ced********

The ID of the image repository.

Replicas Integer Query No 4

The number of instances for the application that you want to create.

LimitCpu Integer Query No 4

The maximum number of CPUs allowed for each application instance when the application is running. Unit: cores.

LimitMem Integer Query No 2

The maximum amount of memory allowed for each application instance when the application is running. Unit: MB.

RequestsCpu Integer Query No 0

The maximum number of CPUs allowed for each application instance when the application is created. Unit: cores. The value 0 indicates no limit.

RequestsMem Integer Query No 0

The maximum amount of memory allowed for each application instance when the application is created. Unit: MB. The value 0 indicates no limit.

Command String Query No ls

The command that is specified. If it is specified, it replaces the startup command in the image when the image is started.

CommandArgs String Query No -lh

The collection of commands. The parameter value is a JSON array of strings. An example is [{"argument":"-c"},{"argument":"test"}], where -c and test are two parameters that can be set.

IntranetSlbProtocol String Query No TCP

The protocol of the internal-facing SLB instance. Valid values: TCP, HTTP, and HTTPS.

IntranetSlbId String Query No ae93********

The ID of the internal-facing SLB instance. If this parameter is not specified, Enterprise Distributed Application Service (EDAS) automatically purchases a new SLB instance for you.

InternetSlbId String Query No a3d4********

The ID of the Internet-facing SLB instance. If this parameter is not specified, EDAS automatically purchases a new SLB instance for you.

InternetSlbProtocol String Query No TCP

The protocol of the Internet-facing SLB instance. Valid values: TCP, HTTP, and HTTPS.

InternetSlbPort Integer Query No 80

The frontend port of the Internet-facing SLB instance. Valid values: 1 to 65535.

InternetTargetPort Integer Query No 8080

The backend port of the internal-facing SLB instance, which is also the service port of the application. Valid values: 1 to 65535.

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

The collection of deployment environment variables. The parameter value must be a JSON array of strings, such as [{"name":"x","value":"y"},{"name":"x2","value":"y2"}].

Note If you want to cancel this configuration, you must set an empty JSON array, which is .
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.

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.

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

The liveness check on the container. An example of the value is {"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.

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 readiness check on the container. If the check fails, the traffic that passes through the Kubernetes service is not transmitted to the container. An example of the value is {"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.

NasId String Query No dfs23****

The ID of the Network Attached 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. The value is a serialized JSON string. For example, the value can be [{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}]. The nasPath parameter specifies the file storage path, and the mountPath parameter specifies the path to mount the file system to the container where the application is running.

StorageType String Query No Performance

Only SSD is 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, the value can be [{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}]. In the example,

  • nodePath specifies the host path.
  • mountPath specifies the path within the container.
  • type specifies the mounting type.
Namespace String Query No default

The namespace of the Kubernetes cluster. This parameter determines the Kubernetes namespace where your application is deployed. By default, this parameter is set to default.

LogicalRegionId String Query No cn-shenzhen:beta****

The ID of the EDAS namespace. This parameter is required for a non-default namespace.

PackageType String Query No WAR

The type of the deployment package. Valid values: FatJar, WAR, and Image.

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 must be set for the applications that are deployed by using FatJar or WAR packages.

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

The version of the deployment package. This parameter is required when the PackageType parameter is set to WAR or FatJar. You must specify a version.

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

The version of Java Development Kit (JDK) on which the deployment package of the application depends. Valid values: Open JDK 7 and Open JDK 8. This parameter is not supported when you deploy an application by using images.

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 when you deploy an application by using images.

EdasContainerVersion String Query No 3.5.9

The version of EDAS Container on which the deployment package of the application depends.

Note This parameter is not supported when you deploy an application by using images.
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 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 application configuration, the default value false is applied.
RequestsmCpu Integer Query No 2

The maximum number of CPUs allowed for each application instance when the application is created. Unit: cores.

LimitmCpu Integer Query No 0

The maximum number of CPUs allowed for each application instance when the application is running. Unit: cores. The value 0 indicates no limit.

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 true indicates yes, whereas other values indicate no.

Timeout Integer Query No 60

The timeout interval of the change process. 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 configuration will be deleted. Valid values:

  • useDefaultConfig: Specifies whether to use the custom configuration. The value true indicates that the custom configuration is not used, whereas the value 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: The application access path is the name of the WAR package. You do not need to enter a custom path.
    • root: The application access path is /. You do not need to enter a custom path.
    • custom: If you select this option, you must set contextPath to a custom path.
  • contextPath: The custom path. This parameter is required only when the contextInputType parameter is set to custom.
  • httpPort: The port range is from 1024 to 65535. The admin permission is configured for the container, but the root permission is required to perform operations on ports with numbers less than 1024. Therefore, enter a value greater than 1024 within the range. If you do not specify this parameter, 8080 is the default value.
  • maxThreads: The 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: The encoding format for Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. If you do not specify this parameter, ISO-8859-1 is the default value.
  • useBodyEncoding: specifies whether to use BodyEncoding for URL.
  • useAdvancedServerXml: specifies whether to use advanced configurations to customize the server.xml file. When the preceding parameter type and specific parameters cannot meet your requirements, you can use advanced configurations to edit the server.xml file of Tomcat.
  • serverXml: The content of the server.xml file customized 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"}}

The configuration of Java startup parameters for a Java application. These 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. The parameter value is a JSON string. In the example, original indicates the configuration value and startup indicates a startup parameter. The system automatically concatenates all startup values as the configuration of Java startup parameters for the application. If this parameter is set to "" or "{}", the configuration will be 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 configuration will be deleted. Valid values:

  • Configs:
    • type: The collection type. The file type is file and the standard output type is stdout.
    • 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: ^/( +)/(. *)^/$.
IsMultilingualApp Boolean Query No true

Specifies whether the application is a multi-language application.

DeployAcrossNodes String Query No true

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

Response parameters

Parameter Type Example Description
ApplicationInfo Struct

The details of the application.

AppId String e83acea6-****-47e1-96ae-c0e95377****

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

AppName String test

The name of the application.

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.

ClusterType Integer 5

The environment type of the application cluster.

  • 0: normal Docker cluster
  • 1: Swarm cluster (obsolete)
  • 2: Elastic Compute Service (ECS) cluster
  • 3: user-created Kubernetes cluster in EDAS (obsolete)
  • 4: cluster in which Pandora automatically registers applications
  • 5: Container Service Kubernetes cluster and Serverless Kubernetes cluster
Dockerize Boolean true

Indicates whether the application is a Docker application.

  • true
  • false
EdasId String 1172****6608****

The ID of the application user.

Owner String zp

The owner of the application.

RegionId String cn-beijing

The ID of the region.

UserId String edas_test****@aliyun****.com

The Alibaba Cloud account.

Code Integer 200

The HTTP status code returned for the request.

Message String success

The additional information.

RequestId String b197-40ab-9155-****

The ID of the request.

Examples

Sample requests

POST /pop/v5/k8s/acs/create_k8s_app HTTP/1.1
Common request headers
{
  "AppName": ""
  "ClusterId": ""
  "ImageUrl": ""
  "PackageType": ""
}

Sample success responses

XML format

<RequestId>03FD1520-0FD6-436A-****-265318D7****</RequestId>
<HostId>edas.cn-***gzhou. ****.com</HostId>
<Code>200</Code>
<Message>success</Message>

JSON format

{
	"RequestId": "03FD1520-0FD6-436A-****-265318D7****",
	"HostId": "edas.cn-***gzhou. ****.com",
	"Code": "200",
	"Message": "success"
}

Error codes

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