Creates an application service in a Kubernetes cluster.


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

Request syntax

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

Request parameters

Parameter Type Position Required Example Description
AppId String Query Yes 5a166fbd-****-****-a286-781659d9f54c

The ID of the application.

Name String Query Yes service-http

The name of the service in Kubernetes.

ServicePorts Json Query Yes [{"protocol":"TCP","port":80,"targetPort":8080}]

The mapping of service ports. Set the value in the JSONArray format. The following parameters are supported:

  • protocol: the protocol used by the service. Valid values: TCP and UDP. This parameter is required.
  • port: the frontend service port. Valid values: 1 to 65535. This parameter is required.
  • targetPort: the backend container port. Valid values: 1 to 65535. This parameter is required.
  • nodePort: the backend node port. Valid values: 1 to 65535. This parameter is required.


[{"protocol": "TCP", "port": 80, "targetPort": 8080},{"protocol": "TCP", "port": 81, "targetPort": 8081}]
Type String Query Yes ClusterIP

The type of the service in Kubernetes. Valid values: NodePort and ClusterIP.

  • The nodePort value must be unique within a cluster.
  • When you configure multi-port mappings for a service in Kubernetes, you cannot map a service port to multiple container ports by using the same protocol.

Response parameters

Parameter Type Example Description
ChangeOrderId String b4b37bde-a125-****-****-741f7f4a9ae3

The ID of the change process.

Code Integer 200

The HTTP status code.

Message String success

The additional information.

RequestId String 4823-bhjf-23u4-eiufh

The ID of the request.


Sample requests

POST /pop/v5/k8s/acs/k8s_service HTTP/1.1
Common request parameters
"AppId": "5a166fbd-****-****-a286-781659d9f54c",
"Name": "service-http",
"ServicePorts": "[{\"protocol\":\"TCP\",\"port\":80,\"targetPort\":8080}]",
"Type": "ClusterIP"

Sample success responses

XML format


JSON format

    "RequestId": "4823-bhjf-23u4-eiufh",
    "Message": "success",
    "ChangeOrderId": "b4b37bde-a125-****-****-741f7f4a9ae3",
    "Code": 200

Error codes

HttpCode Error code Error message Description
500 Edas.errorcode.PermissionDenied.message You are not authorized to perform the operation. The error message returned because you are not authorized to perform the operation.

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