All Products
Search
Document Center

Enterprise Distributed Application Service:DeployK8sApplication

Last Updated:Jan 08, 2024

Deploys an application in a Container Service for Kubernetes (ACK) cluster or a serverless Kubernetes cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Debug

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
edas:ManageApplicationWrite
  • Application
    acs:edas:{#regionId}:{#accountId}:namespace/{#NameSpaceId}/application/{#AppId}
    none
none

Request syntax

POST /pop/v5/k8s/acs/k8s_apps

Request parameters

ParameterTypeRequiredDescriptionExample
PreStopstringNo

The pre-stop script. Example: {"tcpSocket":{"host":"", "port":8080}}. If you want to cancel this configuration, set this parameter to "" or {}. If you do not specify this parameter, this configuration is ignored.

{\"exec\":{\"command\":[\"ls\",\"/\"]}}"
EnvsstringNo

The environment variables that are used to deploy the application. Set this parameter to a JSON array. Valid values: regular environment variables, Kubernetes ConfigMap environment variables, and 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" } } }

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 "[]".
[{"name":"x1","value":"y1"},{"name":"x2","valueFrom":{"configMapKeyRef":{"name":"my-config","key":"y2"}}},{"name":"x3","valueFrom":{"secretKeyRef":{"name":"my-secret","key":"y3"}}}]
ImageTagstringNo

The tag of the image.

latest
BatchWaitTimeintegerNo

The minimum time interval for the phased release of pods. For more information, see minReadySeconds .

0
CommandstringNo

The commands that you run to start the container.

Note If you want to cancel this configuration, set this parameter to an empty string in the format of "".
ls
AppIdstringYes

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

e83acea6-****-47e1-96ae-c0e953772cdc
PostStartstringNo

The post-start script. Example: {"exec":{"command":\["cat","/etc/group"\]}}. If you want to cancel this configuration, set this parameter to "" or {}. If you do not specify this parameter, this configuration is ignored.

{\"exec\":{\"command\":[\"ls\",\"/\"]}}"
ReadinessstringNo

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: {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"httpGet": {"path": "/consumer","port": 8080,"scheme": "HTTP","httpHeaders": \[{"name": "test","value": "testvalue"}\]}}. If you want to cancel this configuration, set this parameter to "" or {}. If you do not specify this parameter, this configuration is ignored.

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

The configuration for the liveness check on the container. Example: {"failureThreshold": 3,"initialDelaySeconds": 5,"successThreshold": 1,"timeoutSeconds": 1,"tcpSocket":{"host":"", "port":8080}}. If you want to cancel this configuration, set this parameter to "" or {}. If you do not specify this parameter, this configuration is ignored.

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

The argument array in the container start-up command. Set this parameter to a JSON array in the format of \["args1","args2"\], where each key is set to a string. If you want to cancel this configuration, set this parameter to an empty JSON array in the format of "\[\]".

["args1","args2"]
ReplicasintegerNo

The number of application instances. The minimum value is 0.

1
ImagestringNo

The absolute URL of the image. This parameter setting overwrites the setting of the ImageTag parameter.

registry-vpc.cn-beijing.aliyuncs.com/t****/app:v1
CpuLimitintegerNo

The maximum number of CPU cores allowed for each application instance when the application is running. Unit: cores. Value 0 indicates that no limit is set on CPU cores.

1
MemoryLimitintegerNo

The maximum size of memory allowed for each application instance when the application is running. Unit: MB. Value 0 indicates that no limit is set on the memory size.

0
CpuRequestintegerNo

The number of CPU cores requested for each application instance when the application is running. Unit: cores. We recommend that you set this parameter. Value 0 indicates that no limit is set on CPU cores.

Note You must set this parameter together with the CpuLimit parameter. Make sure that the value of this parameter does not exceed that of the CpuLimit parameter.
0
MemoryRequestintegerNo

The size of memory requested for each application instance when the application is running. Unit: MB. We recommend that you set this parameter. If you do not want to apply for a memory quota, set this parameter to 0.

Note You must set this parameter together with the MemoryLimit parameter. Make sure that the value of this parameter does not exceed that of the MemoryLimit parameter.
0
NasIdstringNo

The ID of the Apsara File Storage NAS (NAS) file system mounted to the container in which 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) in which the application resides. 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.

dfs23****
MountDescsstringNo

The description of the NAS mounting configuration. Set this parameter to a serialized JSON string. Example: \[{"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 in which the application is running.

[{"nasPath": "/k8s","mountPath": "/mnt"},{"nasPath": "/files","mountPath": "/app/files"}]
StorageTypestringNo

The storage type of the NAS file system.

  • Valid values for General-purpose NAS file systems: Capacity and Performance.
  • Valid values for Extreme NAS file systems: standard and advance.

You can set this parameter only to Performance.

Performance
LocalVolumestringNo

The configurations that are used when the host files are mounted to the container on which the application is running. Example: \[{"type":"","nodePath":"/localfiles","mountPath":"/app/files"},{"type":"Directory","nodePath":"/mnt","mountPath":"/app/storage"}\]. The nodePath parameter specifies the host path, the mountPath parameter specifies the path within the container, and the type parameter specifies the mounting type.

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

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.
https://e***.oss-cn-beijing.aliyuncs.com/s***-1.0-SNAPSHOT-spring-boot.jar
PackageVersionstringNo

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.
20200720
JDKstringNo

The version of the Java Development Kit (JDK) on which the deployment package of the application depends. Open JDK 7 and Open JDK 8 are supported. This parameter is unavailable if you deploy applications by using images.

Open JDK 8
WebContainerstringNo

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.

apache-tomcat-7.0.91
EdasContainerVersionstringNo

The version of EDAS Container on which the deployment package of the application depends. This parameter is applicable to High-Speed Service Framework (HSF) applications that you deploy by using WAR packages. This parameter is unavailable if you deploy applications by using images.

3.5.9
UriEncodingstringNo

The 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.
GBK
UseBodyEncodingbooleanNo

Specifies whether to use the encoding scheme specified in the request body for URI query parameters.

Note If this parameter is not specified in application configuration, the default value false is applied.
false
UpdateStrategystringNo

The phased release policy.

  • Example 1: One instance for a canary release + Two subsequent batches + Automatic batching + 1-minute batch interval.

{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}

  • Example 2: One instance for a canary release + Two subsequent batches + Manual batching.

{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"manual"},"grayUpdate":{"gray":1}}

  • Example 3: Two batches + Automatic batching + 0-minute batch interval.

{"type":"BatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":0}}

{"type":"GrayBatchUpdate","batchUpdate":{"batch":2,"releaseType":"auto","batchWaitTime":1},"grayUpdate":{"gray":1}}
McpuRequestintegerNo

The minimum number of CPU cores required. Unit: cores. Value 0 indicates that no limit is set on CPU cores.

Note You must set this parameter together with the CpuLimit parameter. Make sure that the value of this parameter does not exceed that of the CpuLimit parameter.
4
McpuLimitintegerNo

The maximum number of CPU cores allowed. Unit: cores. Value 0 indicates that no limit is set on CPU cores.

0
VolumesStrstringNo

The data volume.

test
PackageVersionIdstringNo

The version ID of the deployment package.

2bcc********
ChangeOrderDescstringNo

The description of the change process.

Upgrade
RuntimeClassNamestringNo

The type of the container runtime. Valid values:

  • runc: standard container runtime
  • runv: sandboxed container runtime

This parameter is applicable only to clusters that use sandboxed containers.

runc
DeployAcrossZonesstringNo

Specifies whether to distribute application instances across zones. Value true indicates that application instances are distrubuted across zones. Other values indicate that application instances are not distributed across zones.

true
BatchTimeoutintegerNo

The timeout period for an at-a-time release. Unit: seconds.

60
EnableAhasbooleanNo

Specifies whether to enable access to Application High Availability Service (AHAS).

true
WebContainerConfigstringNo

The Tomcat container configuration. If you want to cancel this configuration, set this parameter to "" or "{}". The following parameters are included in the configuration:

  • useDefaultConfig: specifies whether to use the default configuration. Value true indicates to use the default configuration. Value false indicates to use the custom configuration. If the default configuration is used, the following parameters do not take effect.

  • contextInputType: the type of the access path for the application. Valid values:

    • war: The access path for the application is the name of the WAR package. You do not need to specify a custom path.
    • root: The access path for the application is /. You do not need to specify a custom path.
    • custom: If you select this option, you must specify a custom path for the contextPath parameter.
  • contextPath: the custom access path for the application. This parameter is required only when you set the contextInputType parameter to custom.

  • httpPort: the port number. The port number ranges from 1024 to 65535. Though the admin permissions are configured for the container, the root permissions are required to perform operations on ports whose number is less than 1024. Enter a value that ranges from 1025 to 65535 because the container has only the admin permissions. If you do not configure this parameter, the default port number 8080 is used.

  • maxThreads: the maximum number of connections in the connection pool. Default value: 400.

    **

    NoteThis parameter greatly affects the application performance. We recommend that you set this parameter under professional guidance.

  • uriEncoding: the URI encoding scheme in the Tomcat container. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. If you do not specify this parameter, the default value ISO-8859-1 is used.

  • useBodyEncoding: specifies whether to use the encoding scheme specified in the request body for URI query parameters.

  • useAdvancedServerXml: specifies whether to use advanced configurations to customize the server.xml file. If the preceding parameter types and specific parameters cannot meet your requirements, you can use advanced configurations to customize the server.xml file of Tomcat.

  • serverXml: the content of the server.xml file customized by using advanced configurations. This parameter takes effect only when you set the useAdvancedServerXml parameter to true.

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

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 overheads, 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 settings of Java startup parameters for the application. To delete this configuration, leave the parameter value empty by entering "" or "{}".

{"InitialHeapSize":{"original":512,"startup":"-Xms512m"},"MaxHeapSize":{"original":1024,"startup":"-Xmx1024m"}}
SlsConfigsstringNo

The Logstore configuration. If you want to cancel this configuration, leave the parameter value empty by entering "" or "{}".

  • The following parameters are included in the configuration:

    • type: the collection type. Set this parameter to file to specify the file type. Set this parameter to stdout to specify the standard output type.

    • 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 you leave this parameter 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: ^/(.+)/(.*)^/$.

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

Specifies whether to distribute application instances to multiple nodes. Value true indicates that application instances are distrubuted across zones. Other values indicate that application instances are not distributed across zones.

true
TrafficControlStrategystringNo

The traffic adjustment policy for a canary release.

{"http":{"rules":[{"conditionType":"percent","percent":10}]}}
PvcMountDescsstringNo

The configuration for mounting a Kubernetes PersistentVolumeClaim (PVC) to a directory in an elastic container instance. The following parameters are included in the configuration:

  • pvcName: the name of the PVC. Make sure that the volume exists and is in the Bound state.

  • mountPaths: the directory to which you want to mount the PVC. You can configure multiple directories. You can set the following two parameters for each mount directory:

    • mountPath: the mount path. The mount path must be an absolute path that starts with a forward slash (/).
    • readOnly: the mount mode. Value true indicates the read-only mode. Value false indicates the read and write mode. Default value: false.
[{"pvcName":"nas-pvc-1","mountPaths":[{"mountPath":"/usr/share/nginx/data"},{"mountPath":"/usr/share/nginx/html","readOnly":true}]}]
ConfigMountDescsstringNo

The configuration for mounting a Kubernetes ConfigMap or Secret to a directory in an elastic container instance. The following parameters are included in the configuration:

  • name: the name of the Kubernetes ConfigMap or Secret.
  • type: the type of the API object that you want to mount. You can mount a Kubernetes ConfigMap or Secret.
  • mountPath: the mount path. The mount path must be an absolute path that starts with a forward slash (/).
[ { "name": "nginx-config", "type": "ConfigMap", "mountPath": "/etc/nginx" }, { "name": "tls-secret", "type": "Secret", "mountPath": "/etc/ssh" } ]
EnvFromsstringNo

The Kubernetes environment variables that are configured in EnvFrom mode. A ConfigMap or Secret is mounted to a directory. Each key corresponds to a file in the directory, and the content of the file is the value of the key.

This parameter contains the following parameters:

  • configMapRef: the ConfigMap that is referenced. The following parameter is contained:

    • name: the name of the ConfigMap.
  • secretRef: the Secret that is referenced. The following parameter is contained:

    • name: the name of the Secret.
[{"name":"appname","valueFrom":{"configMapKeyRef":{"name":"appconf","key":"name"}}}]
EmptyDirsstringNo

The configuration for mounting a Kubernetes emptyDir volume to a directory in an elastic container instance. The following parameters are included in the configuration:

  • mountPath: The mount path in the container. This parameter is required.
  • readOnly: (Optional) The mount mode. Value true indicates the read-only mode. Value false indicates the read and write mode. Default value: false.
  • subPathExpr: (Optional) The regular expression that is used to match the subdirectory.
[{"mountPath":"/app-log","subPathExpr":"$(POD_IP)"},{"readOnly":true,"mountPath":"/etc/nginx"}]
CustomAffinitystringNo

The affinity configuration of the pod. This parameter takes effect only if both the DeployAcrossNodes and DeployAcrossZones parameters are set to false.

{"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"beta.kubernetes.io/arch","operator":"NotIn","values":["arm64","arm32"]}]}]},"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":5,"preference":{"matchExpressions":[{"key":"kubernetes.io/os","operator":"In","values":["linux"]}]}}]},"podAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"namespaces":["default"],"topologyKey":"kubernetes.io/hostname","labelSelector":{"matchExpressions":[{"key":"edas.oam.acname","operator":"NotIn","values":["edas-test-app"]}]}}]},"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"namespaces":["default"],"topologyKey":"failure-domain.beta.kubernetes.io/zone","labelSelector":{"matchExpressions":[{"key":"edas.oam.acname","operator":"In","values":["edas-test-app-2"]}]}},"weight":15}]}}
CustomTolerationsstringNo

The scheduling tolerance configuration of the pod. This parameter takes effect only if both the DeployAcrossNodes and DeployAcrossZones parameters are set to false.

[{"key":"edas-taint-key2","operator":"Exists","effect":"NoExecute","tolerationSeconds":50},{"key":"edas-taint-key","operator":"Equal","value":"edas-taint-value","effect":"PreferNoSchedule"}]
BuildPackIdstringNo

The build package number of EDAS Container.

  • You do not need to set the parameter if you do not need to change the EDAS Container version during the deployment.
  • Set the parameter if you need to update the EDAS Container version of the application during the deployment.

You can query the build package number by using one of the following methods:

59
AnnotationsstringNo

The annotation of an application pod.

{"annotation-name-1":"annotation-value-1","annotation-name-2":"annotation-value-2"}
LabelsstringNo

The label of an application pod.

{"label-name-1":"label-value-1","label-name-2":"label-value-2"}
EnableEmptyPushRejectbooleanNo

Specifies whether to enable the empty list protection feature. Valid values:

  • true: enables the empty list protection feature.
  • false: disables the empty list protection feature.
false
EnableLosslessRulebooleanNo

Specifies whether to enable graceful start rules. Valid values:

  • true: enables graceful start rules.
  • false: disables graceful start rules.
true
LosslessRuleWarmupTimeintegerNo

The service prefetching duration. Valid values: 0 to 86400. Unit: seconds.

120
LosslessRuleDelayTimeintegerNo

The delay of service registration. Valid values: 0 to 86400. Unit: seconds.

0
LosslessRuleFuncTypeintegerNo

The number of prefetching curves. Valid values: 0 to 20. The default value is 2, which is suitable for common prefetching scenarios. This value indicates that the received traffic amount of the provider during prefetching is displayed as a quadratic curve.

2
LosslessRuleAlignedbooleanNo

Specifies whether to enable Graceful Rolling Release and configure Complete Service Registration before Readiness Probing. Valid values:

  • true: If you turn on the switch, the system uses the /health path and provides port 55199 for the health check. The system does not intrude into the application. When the service is registered, the system returns HTTP 200 status code. Otherwise, the system returns HTTP 500 status code.
Note If you set both the LosslessRuleRelated parameter and this parameter to true, the operation checks whether the service prefetching is complete.
  • false: If you turn off the switch, the system does not provide a port to check whether the service is registered.
false
LosslessRuleRelatedbooleanNo

Specifies whether to enable Graceful Rolling Release and configure Complete Service Prefetching before Readiness Probing. Valid values:

  • true: If you turn on the switch, the system uses the /health path and provides port 55199 for the health check. The system does not intrude into the application. When service prefetching is complete, the system returns HTTP 200 status code. Otherwise, the system returns HTTP 500 status code.
  • false: If you turn off the switch, the system does not provide a port to check whether service prefetching is complete.
false
LimitEphemeralStorageintegerNo

The maximum size of space required by ephemeral storage. Unit: GB. Value 0 indicates that no limit is set on the ephemeral storage space.

4
RequestsEphemeralStorageintegerNo

The minimum size of space required by ephemeral storage. Unit: GB. Value 0 indicates that no limit is set on the ephemeral storage space.

2

Response parameters

ParameterTypeDescriptionExample
object

The content that is returned.

ChangeOrderIdstring

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

cd65b247-****-475b-ad4b-7039040d625c
Codeinteger

The HTTP status code that is returned.

200
Messagestring

The additional information that is returned.

success
RequestIdstring

The ID of the request.

a5281053-08e4-47a5-b2ab-5c0323de*****

Examples

Sample success responses

JSONformat

{
  "ChangeOrderId": "cd65b247-****-475b-ad4b-7039040d625c",
  "Code": 200,
  "Message": "success",
  "RequestId": "a5281053-08e4-47a5-b2ab-5c0323de*****"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-10The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ImagePlatforms
    Added Input Parameters: Startup
2023-04-11The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: TerminateGracePeriod
2023-04-03The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: CanaryRuleId
2023-03-27The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: UserBaseImageUrl
2023-03-24The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Sidecars
    Added Input Parameters: InitContainers