Updates an application service in a Kubernetes cluster.

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 headers

This operation uses only the common request header. For more information, see Common request parameters.

Request syntax

PUT /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. The name can contain lowercase letters, digits, and hyphens (-). It must start with a letter and end with a letter or digit. The name can be 2 to 32 characters in length.

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.

Example:

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

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.

Examples

Sample requests

PUT /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

<RequestId>4823-bhjf-23u4-eiufh</RequestId>
<Message>success</Message>
<ChangeOrderId>b4b37bde-a125-****-****-741f7f4a9ae3</ChangeOrderId>
<Code>200</Code>

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.