Querying the Deployed Pod List of a Service
Function
This API is used to obtain the deployed pod list of a specified service. You can choose whether to obtain only the running pods. It is used when you need to manage and monitor the pod status of service deployment. Before calling this API, ensure that you have the query permission and provide a valid service ID and deployment ID. Optionally, add a filter for pod status, like obtaining only running pods. The returned list contains the basic information about all pods, including the pod name, IP address and name of the node where the pod is located, pod role, status, and latest update time. If the specified service ID is invalid or the current service does not have a pod, an empty list or the corresponding error message is returned, prompting you to check the validity and permission of the input data.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
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, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
modelarts:service:listDeploymentPods
Read
service *
-
-
-
URI
GET /v2/{project_id}/services/{id}/deployments/{deployment_name}/instances/{name}/pods
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID and Name. Constraints N/A Range Project ID. Default Value N/A |
| id | Yes | String | Definition Service ID, which can be obtained from the response body during service creation or by obtaining services owned by the current user. The service_id field is the service ID. Constraints N/A Range Service ID. Default Value N/A |
| deployment_name | Yes | String | Definition Deployment name, which can be obtained from the response body during deployment creation. You can also obtain the deployments owned by the current user by obtaining service deployments. The name field indicates the deployment name. Constraints N/A Range N/A Default Value N/A |
| name | Yes | String | Definition Service instance name. The value can be all. In this case, all service instances are displayed. Constraints N/A Range Service instance name. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| status | No | Array of strings | Definition Pod status. Multiple statuses can be filtered at a time. Separate multiple statuses with commas (,). No space is allowed. By default, filtering is disabled. The value can be RUNNING, PENDING, SUCCEEDED, FAILED, ABNORMAL, UNKNOWN, or DELETED. Constraints N/A |
| limit | No | Integer | Definition Maximum number of records displayed on each page. Constraints N/A Range [1,500] Default Value 10. |
| offset | No | String | Definition Start page of the pagination list. Constraints N/A Range N/A Default Value 0. |
| pod_name | No | String | Definition Pod name. Range N/A |
| pod_id | No | String | Definition Pod ID. Range N/A |
| pod_node_ip | No | String | Definition IP address of the pod node. Range N/A |
| pod_node_name | No | String | Definition Pod node name. Range N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| current | Integer | Definition Current page number, starting from 0. Range N/A |
| data | Array of ServicePodResponse objects | Definition List of service pods. |
| pages | Integer | Definition Total number of pages, which is calculated based on the limit field and the total number of data records. For example, if the total number of records is 10 and the value of limit (maximum number of records on a page) is 3, there are four pages. Range N/A |
| size | Integer | Definition Number of records on the current page. Range N/A |
| total | Integer | Definition Total number of records. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| pod_id | String | Definition od ID. Range N/A |
| pod_name | String | Definition Pod name. Range N/A |
| pod_node_ip | String | Definition IP address of the node where the pod is located. Range N/A |
| pod_node_name | String | Definition Name of the node where the pod is located. Range N/A |
| pod_role | String | Definition Pod role. Range N/A |
| status | String | Definition Pod service status. Range There are seven statuses: RUNNING, PENDING, SUCCEEDED, FAILED, ABNORMAL, UNKNOWN, and DELETED. |
| update_time | Long | Definition Last update time Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 404
Example Requests
Query a specified pod list.
GET https://{endpoint}/v2/{project_id}/services/{service_id}/deployments/{deployment_id}/instances/{name}/pods?status=DELETED,SUCCEEDED Example Responses
Status code: 200
Pod list.
{
"current" : 0,
"data" : [ {
"pod_id" : "7e92b18d-555d-4155-887b-3c7aedf267e9",
"pod_name" : "infer-e274e26d-8348-48b5-ab20-143860879899-au4bc-role-0-65xmt6s",
"pod_node_ip" : "100.**.**.**",
"pod_node_name" : "os-node-created-5l9bf",
"pod_role" : "role-0",
"status" : "RUNNING"
} ],
"pages" : 1,
"size" : 10,
"total" : 1
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Pod list. |
| 400 | Invalid request parameter. |
| 401 | Authentication failed. |
| 403 | Insufficient permissions. |
| 404 | Resource not found. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot