Updated on 2026-04-03 GMT+08:00

Querying Kubernetes Service Details

Function

This API is used to query Kubernetes service details.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

GET /v5/{project_id}/kubernetes/service/detail

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID, which is used to specify the project that an asset belongs to. After the project ID is configured, you can query assets in the project using the project ID. For details about how to obtain it, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 1 to 256 characters.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition

Enterprise project ID, which is used to filter assets in different enterprise projects. For details, see Obtaining an Enterprise Project ID.

To query assets in all enterprise projects, set this parameter to all_granted_eps.

Constraints

You need to set this parameter only after the enterprise project function is enabled.

Range

The value can contain 1 to 256 characters.

Default Value

0: default enterprise project.

id

Yes

String

Service ID.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token, which contains user identity and permissions. The token can be used for identity authentication when an API is called. For details about how to obtain the token, see Obtaining a User Token.

Constraints

N/A

Range

The value can contain 1 to 32,768 characters.

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Service ID

name

String

Service name

endpoint_name

String

Endpoint name

namespace

String

Namespaces

creation_timestamp

Long

Creation timestamp.

cluster_name

String

Cluster name

labels

String

Label

type

String

Definition

Service type (access mode)

Constraints

N/A

Range

  • ClusterIP: accessible only to internal personnel

  • NodePort: exposed externally using NodePort

  • LoadBalancer: exposed externally using LoadBalancer

Default Value

N/A

cluster_ip

String

Cluster IP address

selector

String

Selector

session_affinity

String

Session affinity

service_port_list

Array of KubernetesServicePortInfo objects

Service-associated port list

Table 5 KubernetesServicePortInfo

Parameter

Type

Description

id

String

ID

service_id

String

Associated service ID

name

String

Port name.

protocol

String

Service agreement

port

Integer

Port number

target_port

String

Backend container port

node_port

Integer

Node port

Example Requests

This API is used to query Kubernetes service details.

GET https://{endpoint}/v5/{project_id}/kubernetes/service/detail?id=048fa7bd-xxxx-xxxx-xxxx-a2bf44ae8d65&enterprise_project_id=all_granted_eps

Example Responses

Status code: 200

Request succeeded.

{
  "id" : "048fa7bd-xxxx-xxxx-xxxx-a2bf44ae8d65",
  "name" : "prometheus-operator",
  "endpoint_name" : "prometheus-operator",
  "namespace" : "monitoring",
  "creation_timestamp" : 1720765128000,
  "cluster_name" : "glz-2451",
  "labels" : "{\"app\":\"prometheus-operator\",\"app.kubernetes.io/managed-by\":\"Helm\",\"release\":\"cceaddon-cie-collector\"}",
  "type" : "ClusterIP",
  "cluster_ip" : "10.247.69.251",
  "selector" : "{\"app\":\"prometheus-operator\"}",
  "session_affinity" : "None",
  "service_port_list" : [ {
    "id" : "8cf93aff-xxxx-xxxx-xxxx-4e906c84b68f",
    "service_id" : "048fa7bd-xxxx-xxxx-xxxx-a2bf44ae8d65",
    "name" : "http",
    "protocol" : "TCP",
    "port" : 8080,
    "target_port" : "http"
  }, {
    "id" : "b509362b-xxxxx-xxxx-xxxx-53fefc664c5e",
    "service_id" : "048fa7bd-xxxx-xxxx-xxxx-a2bf44ae8d65",
    "name" : "ready",
    "protocol" : "TCP",
    "port" : 8081,
    "target_port" : "8081"
  } ]
}

Status Codes

Status Code

Description

200

Request succeeded.

Error Codes

See Error Codes.