Creates an application in a Kubernetes cluster or a Serverless Kubernetes cluster.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
edas:CreateApplication |
create |
*All Resource
|
None | None |
Request syntax
POST /pop/v5/k8s/acs/create_k8s_app HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| IntranetTargetPort |
integer |
No |
The backend port of the internal-facing SLB instance. This is also the service port of the application. The value must be in the range of 1 to 65535. |
80 |
| IntranetSlbPort |
integer |
No |
The frontend port of the internal-facing SLB instance. The value must be in the range of 1 to 65535. |
80 |
| ImageUrl |
string |
No |
The address of the image. This parameter is required when you set |
registry.cn-beijing.aliyuncs.com/****_test/****-cons****:1.0 |
| ApplicationDescription |
string |
No |
The description of the application. |
Production Environment |
| RepoId |
string |
No |
The ID of the image repository. |
ced******** |
| Replicas |
integer |
No |
The number of application instances. |
4 |
| LimitCpu |
integer |
No |
The maximum number of CPU cores that can be used by an application instance. If you specify LimitmCpu, this parameter is ignored. |
4 |
| LimitMem |
integer |
No |
The maximum amount of memory that can be used by an application instance. Unit: MB. The value of LimitMem must be greater than or equal to the value of RequestsMem. |
2 |
| RequestsCpu |
integer |
No |
The number of CPU cores requested for an application instance upon creation. Unit: cores. A value of 0 means no limit. If you specify RequestsmCpu, this parameter is ignored. |
0 |
| RequestsMem |
integer |
No |
The amount of memory requested for an application instance upon creation. Unit: MB. A value of 0 means no limit. The value of RequestsMem cannot be greater than the value of LimitMem. |
0 |
| Command |
string |
No |
The startup command of the application. If you set this parameter, the original startup command of the image is overridden. |
ls |
| CommandArgs |
string |
No |
The arguments for the startup command. The arguments are a JSON array of strings. Example: |
[{"argument":"-lh"}] |
| AppName |
string |
Yes |
The name of the application. The name must start with a letter and can contain digits, letters, and hyphens (-). The name can be up to 36 characters in length. |
doc-test |
| IntranetSlbProtocol |
string |
No |
The protocol used by the internal-facing SLB instance. Valid values: TCP, HTTP, and HTTPS. |
TCP |
| IntranetSlbId |
string |
No |
The ID of the internal-facing SLB instance. If you do not specify this parameter, EDAS automatically purchases a new SLB instance for you. |
ae93******** |
| ClusterId |
string |
Yes |
The ID of the cluster. You can call the ListCluster operation to query the cluster ID. For more information, see ListCluster. |
c9cd**** |
| InternetSlbId |
string |
No |
The ID of the internet-facing SLB instance. If you do not specify this parameter, EDAS automatically purchases a new SLB instance for you. |
a3d4******** |
| InternetSlbProtocol |
string |
No |
The protocol used by the internet-facing SLB instance. Valid values: TCP, HTTP, and HTTPS. |
TCP |
| InternetSlbPort |
integer |
No |
The frontend port of the internet-facing SLB instance. The value must be in the range of 1 to 65535. |
80 |
| InternetTargetPort |
integer |
No |
The backend port of the internal SLB instance, which also serves as the service port for the application. The port number must be an integer from 1 to 65535. |
8080 |
| Envs |
string |
No |
The environment variables for the deployment. The value must be a JSON array of objects. Three types of environment variables are supported: regular environment variables, Kubernetes ConfigMap environment variables, and Kubernetes Secret environment variables. The format of a regular environment variable is as follows:
You can use a ConfigMap to inject the value of a specific key into a container's environment variable. The format is as follows:
You can use a Secret to inject the value of a specific key into a container's environment variable. The format is as follows:
Note
To clear this configuration, set the value to an empty JSON array ([]). |
[{"name":"x1","value":"y1"},{"name":"x2","valueFrom":{"configMapKeyRef":{"name":"my-config","key":"y2"}}},{"name":"x3","valueFrom":{"secretKeyRef":{"name":"my-secret","key":"y3"}}}] |
| PreStop |
string |
No |
The script that is run before the container is stopped. Example: To clear this configuration, set the value to |
{\"exec\":{\"command\":[\"ls\",\"/\"]}}" |
| PostStart |
string |
No |
The script that is run after the container is started. Example: To clear this configuration, set the value to |
{\"exec\":{\"command\":[\"ls\",\"/\"]}}" |
| Liveness |
string |
No |
The liveness probe of the container. Example: To clear this configuration, set the value to |
{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}} |
| Readiness |
string |
No |
The readiness probe of the container. If the check fails, traffic is not routed to the container through the Kubernetes Service. Example: To clear this configuration, set the value to |
{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": [{"name": "test","value": "testvalue"}]}} |
| NasId |
string |
No |
The ID of the NAS file system that you want to mount. If you do not specify this parameter but mountDescs is specified, a new NAS file system is automatically purchased and mounted to a vSwitch in the VPC. |
dfs23**** |
| MountDescs |
string |
No |
The description of the mount configuration. The value is a serialized JSON string. Example: |
[{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}] |
| StorageType |
string |
No |
The storage type of the NAS file system. Valid values:
Currently, only the Performance type is supported. |
Performance |
| LocalVolume |
string |
No |
The configuration for mounting a host file to a container. Example:
|
[{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}] |
| Namespace |
string |
No |
The namespace of the Kubernetes cluster. This parameter determines the Kubernetes namespace in which your application is deployed. The default value is default. |
default |
| LogicalRegionId |
string |
No |
The ID of the EDAS namespace. This parameter is required if you want to use a non-default namespace. |
cn-shenzhen:beta**** |
| PackageType |
string |
No |
The type of the application package. Valid values: FatJar, WAR, and Image. |
WAR |
| PackageUrl |
string |
No |
The URL of the deployment package. This parameter is required for applications that are deployed using a FatJar or WAR package. Note
The version of the EDAS POP API SDK for Java or Python must be 2.44.0 or later. |
https://e***.oss-cn-beijing.aliyuncs.com/s***-1.0-SNAPSHOT-spring-boot.jar |
| PackageVersion |
string |
No |
The version number of the deployment package. This parameter is required for WAR and FatJar packages. You can define the meaning of the version number. Note
The version of the EDAS POP API SDK for Java or Python must be 2.44.0 or later. |
20200720 |
| JDK |
string |
No |
The version of the Java Development Kit (JDK) on which the deployment package depends. Valid values: Open JDK 7, Open JDK 8, and Custom OpenJDK. This parameter is not supported for image-based deployments. If you select Custom OpenJDK, you must also specify the UserBaseImageUrl parameter. |
Open JDK 8 |
| WebContainer |
string |
No |
The version of the Tomcat container on which the deployment package depends. This parameter is applicable to Spring Cloud and Dubbo applications that are deployed using a WAR package. This parameter is not supported for image-based deployments. |
apache-tomcat-7.0.91 |
| EdasContainerVersion |
string |
No |
The version of the Note
This parameter is not supported for image-based deployments. |
3.5.9 |
| UriEncoding |
string |
No |
The URI encoding scheme. Valid values: ISO-8859-1, GBK, GB2312, and UTF-8. Note
If you do not set this parameter for the application, the default value of Tomcat is used. |
GBK |
| UseBodyEncoding |
boolean |
No |
Specifies whether to enable useBodyEncodingForURI. Note
If you do not set this parameter for the application, the default value false is used. |
false |
| RequestsmCpu |
integer |
No |
The number of CPU cores requested for an application instance upon creation. Unit: millicores. |
500 |
| LimitmCpu |
integer |
No |
The maximum number of CPU cores that can be used by an application instance. Unit: millicores. A value of 0 means no limit. |
1000 |
| RuntimeClassName |
string |
No |
The type of the container runtime. This parameter is applicable only to clusters that use sandboxed containers. |
runc |
| DeployAcrossZones |
string |
No |
Specifies whether to distribute application instances to multiple zones. A value of |
true |
| Timeout |
integer |
No |
The timeout period for the change process. Unit: seconds. The value must be in the range of 1 to 1800. If you do not specify this parameter, the default value 1800 is used. |
60 |
| EnableAhas |
boolean |
No |
Specifies whether to enable Application High Availability Service (AHAS):
|
true |
| WebContainerConfig |
string |
No |
The configuration of the Tomcat container. To clear the configuration, set the value to "" or "{}":
|
{"useDefaultConfig":false,"contextInputType":"custom","contextPath":"hello","httpPort":8088,"maxThreads":400,"uriEncoding":"UTF-8","useBodyEncoding":true,"useAdvancedServerXml":false} |
| JavaStartUpConfig |
string |
No |
The Java startup parameters. You can configure startup parameters for a Java application. You can configure memory, application, garbage collection (GC) policy, tools, service registration and discovery, and custom parameters. Proper parameter configuration helps reduce GC overhead, shorten server response time, and improve throughput. The value is a JSON string. original specifies the configuration value, and startup specifies the startup parameter. The system automatically concatenates all startup values as the Java startup parameters for the application. To clear the configuration, set the value to
|
{"InitialHeapSize":{"original":512,"startup":"-Xms512m"},"MaxHeapSize":{"original":1024,"startup":"-Xmx1024m"},"CustomParams":{"original":"-Dcustom.property.sample=false","startup":"-Dcustom.property.sample=false"}} |
| SlsConfigs |
string |
No |
The Logstore configuration. To clear the configuration, set the value to
|
[{"logstore":"thisisanotherfilelog","type":"file","logDir":"/var/log/*"},{"logstore":"","type":"stdout","logDir":"stdout.log"},{"logstore":"thisisafilelog","type":"file","logDir":"/tmp/log/*"}] |
| IsMultilingualApp |
boolean |
No |
Specifies whether the application is a multilingual application. |
true |
| DeployAcrossNodes |
string |
No |
Specifies whether to distribute application instances to multiple nodes. A value of |
true |
| PvcMountDescs |
string |
No |
The configuration for mounting a Kubernetes PersistentVolumeClaim (PVC). You can mount a Kubernetes PVC volume to a specified directory in a container. The following parameters are included in PvcMountDescs:
|
[{"pvcName":"nas-pvc-1","mountPaths":[{"mountPath":"/usr/share/nginx/data"},{"mountPath":"/usr/share/nginx/html","readOnly":true}]}] |
| ConfigMountDescs |
string |
No |
The configuration for mounting Kubernetes ConfigMaps and Secrets. You can mount ConfigMaps and Secrets to specified directories in a container. The following parameters are included in ConfigMountDescs:
|
[{"name":"nginx-config","type":"ConfigMap","mountPath":"/etc/nginx"},{"name":"tls-secret","type":"secret","mountPath":"/etc/ssh"}] |
| CsClusterId |
string |
No |
You must specify CsClusterId only when you create an application in a cluster that has never been imported. |
abcdefg |
| EnableAsm |
boolean |
No |
You must set this parameter to true only when you create an application in a cluster that has never been imported and enable Service Mesh (ASM). |
false |
| EnvFroms |
string |
No |
The configuration for environment variables of the Kubernetes EnvFrom type. You can mount a specified ConfigMap or Secret to a specified directory. Each key corresponds to a file in the directory. The content of the file is the value of the key. The following parameters are included in EnvFroms:
|
[{"name":"appname","valueFrom":{"configMapKeyRef":{"name":"appconf","key":"name"}}}] |
| EmptyDirs |
string |
No |
The configuration for mounting a Kubernetes emptyDir volume. You can mount an emptyDir volume to a specified directory in a container. The following parameters are included in EmptyDirs:
|
[{"mountPath":"/app-log","subPathExpr":"$(POD_IP)"},{"readOnly":true,"mountPath":"/etc/nginx"}] |
| BuildPackId |
string |
No |
The version of EDAS Container. This parameter conflicts with |
-1 |
| CustomAffinity |
string |
No |
The custom affinity. |
demo |
| CustomTolerations |
string |
No |
The custom tolerations. |
demo |
| ResourceGroupId |
string |
No |
The ID of the resource group. |
461 |
| Annotations |
string |
No |
The annotations of the application pod. |
{"annotation-name-1":"annotation-value-1","annotation-name-2":"annotation-value-2"} |
| Labels |
string |
No |
The labels of the application pod. |
{"label-name-1":"label-value-1","label-name-2":"label-value-2"} |
| EnableEmptyPushReject |
boolean |
No |
Specifies whether to enable protection against empty pushes:
|
false |
| EnableLosslessRule |
boolean |
No |
Specifies whether to enable the graceful start rule:
|
true |
| LosslessRuleWarmupTime |
integer |
No |
The warm-up duration of the service. Unit: seconds. The value must be in the range of 0 to 86400. |
120 |
| LosslessRuleDelayTime |
integer |
No |
The delay of service registration. Unit: seconds. The value must be in the range of 0 to 86400. |
0 |
| LosslessRuleFuncType |
integer |
No |
The warm-up curve of the service. The value must be in the range of 0 to 20. Default value: 2. This value is suitable for normal warm-up scenarios and indicates that the traffic that the service provider receives follows a quadratic curve during the warm-up period. |
2 |
| LosslessRuleAligned |
boolean |
No |
Specifies whether to enable the graceful rolling deployment mode in which service registration is complete before the readiness probe is passed:
|
false |
| LosslessRuleRelated |
boolean |
No |
Specifies whether to enable the graceful rolling deployment mode in which service warm-up is complete before the readiness probe is passed:
|
false |
| ServiceConfigs |
string |
No |
The configuration of the Kubernetes Service. |
[{"name": "test-svc-create","serviceType":"ClusterIP","portMappings":[{"servicePort": {"targetPort":8080,"port":80,"protocol":"TCP"}}]}] |
| AppTemplateName |
string |
No |
The name of the application template that is used to create the application. If you specify an application template when you create the application, the application template and the AppConfig parameter are preferentially used to determine the application configuration. Other configurations are ignored. |
app-template001 |
| AppConfig |
string |
No |
The application configuration when an application template is used. The value is a JSON string. |
{} |
| LimitEphemeralStorage |
integer |
No |
The maximum ephemeral storage. Unit: GB. A value of 0 means no limit. |
4 |
| RequestsEphemeralStorage |
integer |
No |
The minimum ephemeral storage. Unit: GB. A value of 0 means no limit. |
2 |
| SecretName |
string |
No |
The name of the image pull secret. You must create the secret. |
edas-app-01-image-secret |
| ContainerRegistryId |
string |
No |
The ID of the repository that is used to build the image repository. If you leave this parameter empty, the default repository provided by EDAS is used. Currently, only the default repository provided by EDAS is supported. |
leave empty |
| WorkloadType |
string |
No |
The type of the workload. Currently, only deployments are supported. |
Deployment |
| Sidecars |
string |
No |
The sidecar containers for the application pod. You can set the container configuration in the YAML format. The value is the Base64-encoded YAML configuration of the sidecar container. |
[{"yamlEncoded":"Y29tbWFuZDoKICAtIHRhaWwKICAtICctZicKICAtIC9kZXYvbnVsbAppbWFnZTogJ2J1c3lib3g6bGF0ZXN0JwpuYW1lOiBidXN5Ym94Cg=="}] |
| InitContainers |
string |
No |
The init containers for the application pod. You can set the container configuration in the YAML format. The value is the Base64-encoded YAML configuration of the init container. |
[ { "yamlEncoded": "Y29tbWFuZDoKICAtIHNsZWVwCiAgLSAnNjAnCmltYWdlOiAnYnVzeWJveDpsYXRlc3QnCm5hbWU6IGluaXQtYnVzeWJveAo=" } ] |
| UserBaseImageUrl |
string |
No |
If you use a custom JDK runtime, you must configure the address of the base image. The address must be accessible over the Internet. The EDAS server pulls the image to build an application image. |
openjdk:8u302 |
| TerminateGracePeriod |
integer |
No |
The timeout period for a graceful stop. Unit: seconds. |
120 |
| ImagePlatforms |
string |
No |
The architecture of the image platform. This parameter is valid when you use a WAR or JAR package for deployment. Examples:
|
linux/arm64,linux/amd64 |
| Startup |
string |
No |
The startup probe. You can use a startup probe to check the liveness of a slow-start container and prevent the container from being killed before it is started. Example: {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": [{"name": "test","value": "testvalue"}]}}. To clear this configuration, set the value to "" or {}. If you do not set this parameter, it is ignored. |
{"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}} |
| FeatureConfig |
string |
No |
The configuration of the custom monitoring and administration solution. |
{"features":[{"name":"base.combination.arms","enable":true},{"name":"base.combination.mse","enable":true}]} |
| CustomAgentVersion |
string |
No |
The version of the agent. |
2.8.3,3.2.10,4.3.1 |
| SecurityContext |
string |
No |
The SecurityContext attribute for the application pod container. The value is the Base64-encoded YAML configuration of the SecurityContext. |
{"yamlEncoded":"cnVuQXNVc2VyOiAwCnJ1bkFzR3JvdXA6IDA="} |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response to the request. |
||
| Code |
integer |
The status code of the interface or the POP error code. |
200 |
| Message |
string |
The additional information. |
success |
| RequestId |
string |
The ID of the request. |
b197-40ab-9155-**** |
| ApplicationInfo |
object |
The details of the application. |
|
| ChangeOrderId |
string |
The ID of the change process. You can call the GetChangeOrderInfo operation to query the ID. For more information, see GetChangeOrderInfo. |
cd65b247-****-475b-ad4b-7039040d625c |
| AppName |
string |
The name of the application. |
test |
| Dockerize |
boolean |
Indicates whether the application is a Docker application.
|
true |
| Owner |
string |
The owner of the application. |
zp |
| EdasId |
string |
The ID of the user account. |
1172****6608**** |
| ClusterType |
integer |
The type of the cluster in which the application is deployed.
|
5 |
| AppId |
string |
The ID of the application. You can call the ListApplication operation to query the application ID. For more information, see ListApplication. |
e83acea6-****-47e1-96ae-c0e95377**** |
| UserId |
string |
The Alibaba Cloud account that is used to create the application. |
edas_test****@aliyun****.com |
| RegionId |
string |
The ID of the region. |
cn-beijing |
Examples
Success response
JSON format
{
"Code": 200,
"Message": "success",
"RequestId": "b197-40ab-9155-****",
"ApplicationInfo": {
"ChangeOrderId": "cd65b247-****-475b-ad4b-7039040d625c",
"AppName": "test",
"Dockerize": true,
"Owner": "zp",
"EdasId": "1172****6608****",
"ClusterType": 5,
"AppId": "e83acea6-****-47e1-96ae-c0e95377****",
"UserId": "edas_test****@aliyun****.com",
"RegionId": "cn-beijing"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.