文档首页 > > API参考> Kubernetes API> Event> 列出指定的Event

列出指定的Event

分享
更新时间:2020/05/26 GMT+08:00

功能介绍

This API is used to list all Event resource objects under a specified Namespace.

URI

GET /api/v1/namespaces/{namespace}/events

表1描述该API的参数。

表1 参数解释

参数

是否必选

描述

namespace

Yes

Object name and auth scope, such as for teams and projects.

pretty

No

If 'true', then the output is pretty printed.

includeUninitialized

No

If true, partially initialized resources are included in the response.

fieldSelector

No

A selector to restrict the list of returned objects by their fields. Defaults to everything.

labelSelector

No

A selector to restrict the list of returned objects by their labels. Defaults to everything.

resourceVersion

No

When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.

timeoutSeconds

No

Timeout for the list/watch call.

watch

No

Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.

请求消息

N/A

响应消息

响应参数:

响应参数请参见表2

表2 响应参数

名称

参数类型

描述

kind

String

A string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase.

apiVersion

String

Versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

metadata

metadata object

-

items

items object

List of replication controllers.

表3 items字段数据结构说明

名称

参数类型

描述

metadata

metadata object

Standard object's metadata.

involvedObject

involvedObject object

The object that this event is about.

kind

String

Kind is a string value representing the REST resource this object represents.

reason

String

This should be a short, machine understandable string that gives the reason for the transition into the object's current status.

message

String

A human-readable description of the status of this operation.

source

source object

The component reporting this event. Should be a short machine understandable string.

firstTimestamp

Time

The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)

lastTimestamp

Time

The time at which the most recent occurrence of this event was recorded.

count

Integer

The number of times this event has occurred.

type

String

Type of this event (Normal, Warning), new types could be added in the future.

表4 involvedObject字段数据结构说明

名称

参数类型

描述

kind

String

Kind of the referent.

namespace

String

Namespace of the referent.

name

String

Name of the referent.

uid

String

UID of the referent.

apiVersion

String

API version of the referent.

resourceVersion

String

Specific resourceVersion to which this reference is made.

fieldPath

String

If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object.

表5 source字段数据结构说明

名称

参数类型

描述

component

String

Component from which the event is generated.

host

String

Node name on which the event is generated.

响应示例

{
    "kind": "EventList",
    "apiVersion": "v1",
    "metadata": {
        "selfLink": "/api/v1/namespaces/default/events",
        "resourceVersion": "6218"
    },
    "items": [
        {
            "metadata": {
                "name": "asdf-554b5dfc44-7mm4f.152b13061a06a7c2",
                "namespace": "default",
                "selfLink": "/api/v1/namespaces/default/events/asdf-554b5dfc44-7mm4f.152b13061a06a7c2",
                "uid": "9e033be0-4ea6-11e8-8c02-fa163e69d0fd",
                "resourceVersion": "6218",
                "creationTimestamp": "2018-05-03T07:50:15Z",
                "enable": true
            },
            "involvedObject": {
                "kind": "Pod",
                "namespace": "default",
                "name": "asdf-554b5dfc44-7mm4f",
                "uid": "9dff08f2-4ea6-11e8-8c02-fa163e69d0fd",
                "apiVersion": "v1",
                "resourceVersion": "1767656"
            },
            "reason": "FailedScheduling",
            "message": "0/1 nodes are available: 1 Insufficient memory.",
            "source": {
                "component": "default-scheduler"
            },
            "firstTimestamp": "2018-05-03T07:50:15Z",
            "lastTimestamp": "2018-05-03T07:50:22Z",
            "count": 5,
            "type": "Warning",
            "eventTime": null,
            "reportingComponent": "",
            "reportingInstance": ""
        }
    ]
}

状态码

表6描述API的状态码。

表6 状态码

状态码

描述

200

This operation succeeds, and a Event resource object is returned.

异常状态码请参见状态码

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!非常感谢您的反馈,我们会继续努力做到更好!
反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

智能客服提问云社区提问