You can call the operation to create a container service K8s application.

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 only uses common request headers. For more information, see the Common request parameters topic.

Request syntax

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

Request parameters

Parameter Type Required Example Description
AppName String Yes doc-test

The name of the service. The name can contain digits, letters, and hyphens (-). It must start with a letter and can contain a maximum of 36 characters.

ClusterId String Yes c9cd incremental memory usage *

The ID of the cluster that you want to scale out.

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

The address of the image.

PackageType String Yes WAR

The type of the app package. You can use FatJar, WAR, and Image as optional parameters.

IntranetTargetPort Integer No 80

The backend port of the internal SLB instance, which is also the service port of an application. The port range is 1 to 65535.

IntranetSlbPort Integer No 80

The frontend port range of the internal SLB instance: 1 to 65535.

ApplicationDescription String No Applications in production environment

The description of the application.

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

The repoId of the image.

Replicas Integer No 4

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

LimitCpu Integer No 4

The CPU utilization of the application instance when the application is running. Unit: number of cores.

LimitMem Integer No 2

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

RequestsCpu Integer No 0

The CPU limit of the application instance when the application is created. Unit: number of cores. If the value is set to 0, the throttling policy is not configured.

RequestsMem Integer No 0

The memory limit of an application instance when the application is created. Unit: MB. If the value is set to 0, the throttling policy is not configured.

Command String No ""

The command that was specified. If it is specified, it will replace the command when the image is started.

CommandArgs String No ""

The string in a JSON Array. The format is [{"argument":"-c"},{"argument":"test"}]. Where,-c and test are the two parameters to be set.

IntranetSlbProtocol String No TCP

The intranet SLB protocol. TCP, HTTP, and HTTPS are supported.

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

The internal SLB instance ID. If this parameter is not configured, EDAS automatically purchases new SLB instances for you.

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

The ID of the Internet SLB instance. If this parameter is not configured, EDAS automatically purchases new SLB instances for you.

InternetSlbProtocol String No TCP

The Internet SLB protocol. TCP, HTTP, and HTTPS are supported.

InternetSlbPort Integer No 80

The frontend port range of the Internet SLB instance is 1-65535.

InternetTargetPort Integer No 8080

The backend port of the intranet SLB instance, which is also the service port of an application, ranging from 1 to 65535.

Envs String No ""

The environment variable of the container. The parameter is a JsonArray string in the format of [{"name":"testkey","value":"testValue"}].

PreStop String No ""

Run a script in the format of {"tcpSocket":{"host":"", "port":8080}} before stopping the job.

PostStart String No ""

Run the script in the format of {"exec":{"command":"cat","/etc/group"}}.

Liveness String No ""

The script to be run to check the liveness of the container for the application. The value is in the format of {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}.

Readiness String No ""

If the container business status check fails, traffic passing through the K8s service is not transferred to the new container. Example: {"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 to which the NAS file systems are mounted, which 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 a virtual switch (VSwitch) in the virtual private cloud (VPC) where the application is located. 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 ""

The description of the NAS mounting configuration. The value is a serialized JSON string. 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 ""

Only the SSD type is supported.

LocalVolume String No ""

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.

Namespace String No default

The namespace of the Kubernetes cluster. It determines the Kubernetes namespace in which your applications are deployed. default is selected by default.

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

The ID of the EDAS namespace. It must be a non-default namespace.

PackageUrl String No ""

The address where the deployment package of the application is located. If you deploy an application by using a FatJar or WAR package, you must specify the deployment package address. The Java or Python SDK of EDAS POP API must be v2.44.0 or later.

PackageVersion String No ""

The version of the deployment package. This parameter must be set to WAR or FatJar. Please customize its meaning.

JDK String No Open JDK 8

The JDK Version of the package. The optional parameter values are Open JDK 7 and Open JDK 8. This parameter is not supported when you deploy an application by using images.

WebContainer String 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 are deployed with WAR packages. This parameter is not supported when you deploy an application by using images.

EdasContainerVersion String No EDAS-Container 3.5.5

The EDAS-Container version of the package to deploy. This parameter is not supported when you deploy an application by using images.

UriEncoding String No GBK

The URI encoding method. 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 No false

Indicates whether the useBodyEncodingForURI is enabled.

Note Use the default value false if you do not specify this parameter in application configuration.
RequestsmCpu Integer No 2

The CPU limit of the application instance when the application is created. Unit: number of cores.

LimitmCpu Integer No 0

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.

Response parameters

Parameter Type Example Description
ApplicationInfo Struct

The application details.

AppId STRING e83acea6-****-47e1-96ae-c0e9537****

The ID of workspace to which the node instance belongs.

AppName STRING test

The name of the service.

ChangeOrderId STRING ""

The ID of the change process.

ClusterType INTEGER 5

The environment type of the cluster.

  • 0-common Docker clusters
  • 1-Swarm cluster
  • 2-ECS cluster
  • 3-EDAS on-premises Kubernetes cluster
  • 4-Pandora automatically registers application cluster type
  • 5-container service Kubernetes clusters
Dockerize Boolean true

Indicates whether the application is a Docker application.

EdasId STRING ""

The ID of the user.

Owner STRING ""

The application creator.

RegionId Boolean cn-beijing

The ID of the region.

UserId STRING edas_test****@aliyun****.com

The Apsara Stack tenant account.

Code INTEGER 200

The code.

Message STRING Success

The message.

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 header
{
  "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.