Creates an application in a Container Service for Kubernetes (ACK) cluster or serverless Kubernetes cluster.
Debugging
Request headers
This operation uses only common request headers. For more information, see the topic about common request parameters.
Request syntax
POST /pop/v5/k8s/acs/create_k8s_app HTTP/1.1
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 ID of the cluster. You can call the ListCluster operation to query the cluster ID. |
IntranetTargetPort | Integer | Query | No | 80 |
The backend port of the internal-facing Server Load Balancer (SLB) instance. This port also serves as 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 URL of the image. This parameter is required if you set the |
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 on which you want to create the application. |
LimitCpu | Integer | Query | No | 4 |
The maximum number of CPU cores allowed for each application instance when the application is running. Unit: core. |
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 CPU cores allowed for each application instance when the application is created. Unit: core. A value of 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. A value of 0 indicates no limit. |
Command | String | Query | No | ls |
The command, if specified, that replaces the startup command in the image when the image is started. |
CommandArgs | String | Query | No | -lh |
The arguments in the command. The parameter value is a JSON array of strings. An example
is |
PostStart | String | Query | No | {\"exec\":{\"command\":[\"ls\",\"/\"]}}" |
The post-start script. Example: If you want to cancel this configuration, set this parameter to |
PreStop | String | Query | No | {\"exec\":{\"command\":[\"ls\",\"/\"]}}" |
The pre-stop script. Example: If you want to cancel this configuration, set this parameter to |
InternetSlbId | String | Query | No | a3d4******** |
The ID of the Internet-facing SLB instance. If you do not specify this parameter, Enterprise Distributed Application Service (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. This port also serves as the service port of the application. Valid values: 1 to 65535. |
Envs | String | Query | No | [{"name":"x1","value":"y1"},{"name":"x2","valueFrom":{"configMapKeyRef":{"name":"my-config","key":"y2"}}},{"name":"x3","valueFrom":{"secretKeyRef":{"name":"my-secret","key":"y3"}}}] |
The environment variables that are used to deploy the application. The value must be a JSON array. You can set this parameter to specify regular environment variables, Kubernetes ConfigMap environment variables, or Kubernetes Secret environment variables. Specify regular environment variables in the following format: {"name":"x", "value": "y"}
Specify Kubernetes ConfigMap environment variables in the following format to reference values from ConfigMaps: {
"name": "x2",
"valueFrom": {
"configMapKeyRef": {
"name": "my-config",
"key": "y2"
}
}
} The value of the key in this value can be passed to the value that specifies the
environment variables of the container.
Specify Kubernetes Secret environment variables in the following format to reference values from Secrets: {
"name": "x3",
"valueFrom": {
"secretKeyRef": {
"name": "my-secret",
"key": "y3"
}
}
}
Note If you want to cancel this configuration, set this parameter to an empty JSON array,
which is in the format of "".
|
IntranetSlbId | String | Query | No | ae93******** |
The ID of the internal-facing SLB instance. If you do not specify this parameter, EDAS automatically purchases a new SLB instance for you. |
IntranetSlbProtocol | String | Query | No | TCP |
The protocol of the internal-facing SLB instance. Valid values: TCP, HTTP, and HTTPS. |
Liveness | String | Query | No | null |
The configuration for the liveness check on the container. Example: If you want to cancel this configuration, set this parameter to |
Readiness | String | Query | No | null |
The configuration for the readiness check on the container. If the check fails, the
traffic that passes through the Kubernetes service is not transmitted to the container.
Example: If you want to cancel this configuration, set this parameter to |
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 you do not specify this parameter, but specify the MountDescs parameter, a NAS file system is automatically purchased and mounted to the vSwitch in the VPC. |
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. Example: |
StorageType | String | Query | No | Performance |
The type of the storage. 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. Example:
|
Namespace | String | Query | No | default |
The namespace of the Kubernetes cluster. This parameter determines the Kubernetes namespace where your application is deployed. Default value: 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 is required if you use a FatJar or WAR package to deploy the application. Note The version of EDAS SDK for Java or Python must be V2.44.0 or later.
|
PackageVersion | String | Query | No | 20200720 |
The version of the deployment package. This parameter is required if you use a FatJar or WAR package to deploy the application. You must specify a version. Note The version of EDAS SDK for Java or Python must be V2.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. Valid values: Open JDK 7 and Open JDK 8. This parameter is unavailable if you deploy applications 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 Dubbo applications that you deploy by using WAR packages. This parameter is unavailable if you deploy applications by using images. |
EdasContainerVersion | String | Query | No | 3.5.9 |
The version of Note This parameter is unavailable if you deploy applications 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 you do not specify this parameter in the application configurations, the default
URI encoding scheme in the Tomcat container is applied.
|
UseBodyEncoding | Boolean | Query | No | false |
Specifies whether to use the encoding scheme specified in the request body for URI query parameters. Note If you do not specify this parameter in the application configurations, the default
value false is applied.
|
RequestsmCpu | Integer | Query | No | 2 |
The maximum number of CPU cores allowed for each application instance when the application is created. Unit: core. |
LimitmCpu | Integer | Query | No | 0 |
The maximum number of CPU cores allowed for each application instance when the application is running. Unit: core. A value of 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. A value of
|
Timeout | Integer | Query | No | 60 |
The timeout period 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 | null |
The Tomcat container configuration. If you want to cancel this configuration, set this parameter to "" or "{}". The following parameters are included in the configuration:
|
JavaStartUpConfig | String | Query | No | null |
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.
Set this parameter to 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 you want to cancel this configuration, set this parameter to |
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 you want to cancel this configuration, set this parameter
to
|
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. A value of
|
PvcMountDescs | String | Query | No | [{"pvcName":"nas-pvc-1","mountPaths":[{"mountPath":"/usr/share/nginx/data"},{"mountPath":"/usr/share/nginx/html","readOnly":true}]}] |
The configuration for mounting a Kubernetes PersistentVolumeClaim (PVC) volume to a specified directory in an elastic container instance. The following parameters are included in the configuration:
|
ConfigMountDescs | String | Query | No | [{"name":"nginx-config","type":"ConfigMap","mountPath":"/etc/nginx"},{"name":"tls-secret","type":"secret","mountPath":"/etc/ssh"}] |
The configuration for mounting a Kubernetes ConfigMap or Secret to a specified directory in an elastic container instance. The following parameters are included in the configuration:
|
CsClusterId | String | Query | No | abcdefg |
The ID of the cluster. This parameter is required only when you create the application in a cluster that has not been imported. |
EnableAsm | Boolean | Query | No | false |
Specifies whether to activate Alibaba Cloud Service Mesh (ASM). Set this parameter to true only when you create the application in a cluster that has not been imported and need to use ASM. |
EnvFroms | String | Query | No | [{"name":"appname","valueFrom":{"configMapKeyRef":{"name":"appconf","key":"name"}}}] |
The Kubernetes environment variables that are configured in EnvFrom mode. A specified ConfigMap or Secret is mounted to a specified directory. Each key corresponds to a file in the directory, and the content of the file is the value that corresponds to the key. This parameter contains the following parameters:
|
EmptyDirs | String | Query | No | [{"mountPath":"/app-log","subPathExpr":"$(POD_IP)"},{"readOnly":true,"mountPath":"/etc/nginx"}] |
The configuration for mounting a Kubernetes emptyDir volume to a specified directory in an elastic container instance. The following parameters are included in the configuration:
|
BuildPackId | String | Query | No | -1 |
The version of |
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 call the ListApplication operation to query the application ID. |
AppName | String | test |
The name of the application. |
ChangeOrderId | String | cd65b247-****-475b-ad4b-7039040d625c |
The ID of the change process. You can call the GetChangeOrderInfo operation to query the change process ID. |
ClusterType | Integer | 5 |
The type of the cluster.
|
Dockerize | Boolean | true |
Indicates whether the application is a Docker application. Valid values:
|
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. |
Message | String | success |
The returned message that indicates whether the call is successful. |
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": "doc-test",
"ClusterId": "c9cd****"
}
Sample success responses
XML
format
<InsertK8sApplicationResponse>
<RequestId>b197-40ab-9155-****</RequestId>
<Message>success</Message>
<ApplicationInfo>
<Dockerize>true</Dockerize>
<EdasId>1172****6608****</EdasId>
<Owner>zp</Owner>
<AppId>e83acea6-****-47e1-96ae-c0e95377****</AppId>
<UserId>edas_test****@aliyun****.com</UserId>
<ChangeOrderId>cd65b247-****-475b-ad4b-7039040d625c</ChangeOrderId>
<RegionId>cn-beijing</RegionId>
<ClusterType>5</ClusterType>
<AppName>test</AppName>
</ApplicationInfo>
<Code>200</Code>
</InsertK8sApplicationResponse>
JSON
format
{
"InsertK8sApplicationResponse": {
"RequestId": "b197-40ab-9155-****",
"Message": "success",
"ApplicationInfo": {
"Dockerize": true,
"EdasId": "1172****6608****",
"Owner": "zp",
"AppId": "e83acea6-****-47e1-96ae-c0e95377****",
"UserId": "edas_test****@aliyun****.com",
"ChangeOrderId": "cd65b247-****-475b-ad4b-7039040d625c",
"RegionId": "cn-beijing",
"ClusterType": 5,
"AppName": "test"
},
"Code": 200
}
}
Error codes
For a list of error codes, visit the API Error Center.