Querying Pod Events
Function
This API is used to obtain Kubernetes events of a specified pod. It is applicable to scenarios where the pod running status needs to be monitored and checked. Before calling this API, ensure that you have the query permission and provide a valid pod ID. The returned event list contains details about all events, including the event type, occurrence times, event name, event information, and occurrence time. If the provided pod ID is invalid, the pod does not exist, or the permission is insufficient, an 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:listDeploymentPodEvents
Read
service *
-
-
-
URI
GET /v2/{project_id}/services/{id}/deployments/{deployment_name}/instances/{instance_name}/pods/{name}/events
| 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 |
| instance_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 |
| name | Yes | String | Definition Service instance pod 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 |
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 |
|---|---|---|
| [items] | Array of ServicePodEventResponse objects | Definition Service pod event list. |
| Parameter | Type | Description |
|---|---|---|
| count | Integer | Definition Event occurrences. Range N/A |
| first_timestamp | String | Definition First occurrence time. Range N/A |
| last_timestamp | String | Definition Latest occurrence time. Range N/A |
| message | String | Definition Describes event type information. Range N/A |
| reason | String | Definition Event name. Range N/A |
| reporting_component | String | Definition Name of the Kubernetes component that reports the event. Range N/A |
| type | String | Definition Event type. Range Normal/Warning. |
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 events of a specified pod.
GET https://{endpoint}/v2/{project_id}/services/{service_id}/deployments/{deployment_id}/instances/{name}/pods/{pod_name}/events Example Responses
Status code: 200
Pod event list.
[ {
"count" : 5,
"first_timestamp" : "2025-05-24T08:11:24Z",
"last_timestamp" : "2025-05-24T08:11:53Z",
"message" : "Back-off restarting failed container infer-5efd9b09-1f85-49f7-8735-9ec539ebac93 in pod infer-689e24bb-4489-499b-becb-9ec539ebac93-cfvs4-role-0-68cj4gd_pool-x-infer-04f258c84780d5a52f3bc00dc15aa5e7(bc6663ae-657c-4a4b-bb3e-35011483e4e9)",
"reason" : "BackOffStart",
"reporting_component" : "kubelet",
"type" : "Warning"
}, {
"count" : 5,
"first_timestamp" : "2025-05-24T08:11:24Z",
"last_timestamp" : "2025-05-24T08:11:53Z",
"message" : "the failed container exited with ExitCode: 1",
"reason" : "BackOffStart",
"reporting_component" : "kubelet",
"type" : "Warning"
}, {
"count" : 3,
"first_timestamp" : "2025-05-24T08:11:23Z",
"last_timestamp" : "2025-05-24T08:11:38Z",
"message" : "Started container infer-5efd9b09-1f85-49f7-8735-9ec539ebac93",
"reason" : "Started",
"reporting_component" : "kubelet",
"type" : "Normal"
} ] Status Codes
| Status Code | Description |
|---|---|
| 200 | Pod event 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