---
api_metadata:
apiVersion: "events.k8s.io/v1"
import: "k8s.io/api/events/v1"
kind: "Event"
content_type: "api_reference"
description: "Event 是集群中某个事件的报告。"
title: "Event"
weight: 3
---
`apiVersion: events.k8s.io/v1`
`import "k8s.io/api/events/v1"`
## Event {#Event}
Event 是集群中某个事件的报告。它一般表示系统的某些状态变化。
Event 的保留时间有限,触发器和消息可能会随着时间的推移而演变。
事件消费者不应假定给定原因的事件的时间所反映的是一致的下层触发因素,或具有该原因的事件的持续存在。
Events 应被视为通知性质的、尽最大努力而提供的补充数据。
- **apiVersion**: events.k8s.io/v1
- **kind**: Event
- **metadata** (}}">ObjectMeta)
标准的对象元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- **eventTime** (MicroTime),必需
evenTime 是该事件首次被观察到的时间。它是必需的。
**MicroTime 是微秒级精度的 Time 版本**
- **action** (string)
action 是针对相关对象所采取的或已失败的动作。字段值是机器可读的。对于新的 Event,此字段不能为空,
且最多为 128 个字符。
- **deprecatedCount** (int32)
deprecatedCount 是确保与 core.v1 Event 类型向后兼容的已弃用字段。
- **deprecatedFirstTimestamp** (Time)
deprecatedFirstTimestamp 是确保与 core.v1 Event 类型向后兼容的已弃用字段。
**Time 是对 time.Time 的封装。Time 支持对 YAML 和 JSON 进行正确封包。为 time 包的许多函数方法提供了封装器。**
- **deprecatedLastTimestamp** (Time)
deprecatedLastTimestamp 是确保与 core.v1 Event 类型向后兼容的已弃用字段。
**Time 是对 time.Time 的封装。Time 支持对 YAML 和 JSON 进行正确封包。为 time 包的许多函数方法提供了封装器。**
- **deprecatedSource** (EventSource)
deprecatedSource 是确保与 core.v1 Event 类型向后兼容的已弃用字段。
**EventSource 包含事件信息。**
- **deprecatedSource.component** (string)
生成事件的组件。
- **deprecatedSource.host** (string)
产生事件的节点名称。
- **note** (string)
node 是对该操作状态的可读描述。注释的最大长度是 1kB,但是库应该准备好处理最多 64kB 的值。
- **reason** (string)
reason 是采取行动的原因。它是人类可读的。对于新的 Event,此字段不能为空,且最多为128个字符。
- **regarding** (}}">ObjectReference)
关于包含此 Event 所涉及的对象。在大多数情况下,所指的是报告事件的控制器所实现的一个 Object。
例如 ReplicaSetController 实现了 ReplicaSet,这个事件被触发是因为控制器对 ReplicaSet 对象做了一些变化。
- **related** (}}">ObjectReference)
related 是用于更复杂操作的、可选的、从属性的对象。例如,当 regarding 对象触发 related 对象的创建或删除时。
- **reportingController** (string)
reportingController 是触发该事件的控制器的名称,例如 `kubernetes.io/kubelet`。对于新的 Event,此字段不能为空。
- **reportingInstance** (string)
reportingInstance 为控制器实例的 ID,例如 `kubelet-xyzf`。对于新的 Event,此字段不能为空,且最多为 128 个字符。
- **series** (EventSeries)
series 是该事件代表的事件系列的数据,如果是单事件,则为 nil。
EventSeries 包含一系列事件的信息,即一段时间内持续发生的事情。
EventSeries 的更新频率由事件报告者决定。
默认事件报告程序在 "k8s.io/client-go/tools/events/event_broadcaster.go"
展示在发生心跳时该结构如何被更新,可以指导定制的报告者实现。
- **series.count** (int32),必需
count 是到最后一次心跳时间为止在该系列中出现的次数。
- **series.lastObservedTime** (MicroTime),必需
lastObservedTime 是在最后一次心跳时间之前看到最后一个 Event 的时间。
**MicroTime 是微秒级精度的 Time 版本。**
- **type** (string)
type 是该事件的类型(Normal、Warning),未来可能会添加新的类型。字段值是机器可读的。
对于新的 Event,此字段不能为空。
## EventList {#EventList}
EventList 是一个 Event 对象列表。
- **apiVersion**: events.k8s.io/v1
- **kind**: EventList
- **metadata** (}}">ListMeta)
标准的列表元数据。更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- **items** ([]}}">Event),必需
items 是模式(Schema)对象的列表。
## 操作 {#操作}
### `get` 读取特定 Event
#### HTTP 请求
GET /apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}
#### 参数
- **name** (**路径参数**):string,必需
Event 名称
- **namespace** (**路径参数**):string,必需
}}">namespace
- **pretty** (**路径参数**):string
}}">pretty
#### 响应
200 (}}">Event): OK
401: Unauthorized
### `list` 列出或观察事件类型对象
#### HTTP 请求
GET /apis/events.k8s.io/v1/namespaces/{namespace}/events
#### 参数
- **namespace** (**路径参数**):string,必需
}}">namespace
- **allowWatchBookmarks** (**查询参数**):boolean
}}">allowWatchBookmarks
- **continue** (**查询参数**):string
}}">continue
- **fieldSelector** (**查询参数**):string
}}">fieldSelector
- **labelSelector** (**查询参数**):string
}}">labelSelector
- **limit** (**查询参数**):integer
}}">limit
- **pretty** (**查询参数**):string
}}">pretty
- **resourceVersion** (**查询参数**):string
}}">resourceVersion
- **resourceVersionMatch** (**查询参数**):string
}}">resourceVersionMatch
- **timeoutSeconds** (**查询参数**):integer
}}">timeoutSeconds
- **watch** (**查询参数**):boolean
}}">watch
#### 响应
200 (}}">EventList): OK
401: Unauthorized
### `list` 列出或观察事件类型对象
#### HTTP 请求
GET /apis/events.k8s.io/v1/events
#### 参数
- **allowWatchBookmarks** (**查询参数**):boolean
}}">allowWatchBookmarks
- **continue** (**查询参数**):string
}}">continue
- **fieldSelector** (**查询参数**):string
}}">fieldSelector
- **labelSelector** (**查询参数**):string
}}">labelSelector
- **limit** (**查询参数**):integer
}}">limit
- **pretty** (**查询参数**):string
}}">pretty
- **resourceVersion** (**查询参数**):string
}}">resourceVersion
- **resourceVersionMatch** (**查询参数**):string
}}">resourceVersionMatch
- **timeoutSeconds** (**查询参数**):integer
}}">timeoutSeconds
- **watch** (**查询参数**):boolean
}}">watch
#### 响应
200 (}}">EventList): OK
401: Unauthorized
### `create` 创建一个 Event
#### HTTP 请求
POST /apis/events.k8s.io/v1/namespaces/{namespace}/events
#### 参数
- **namespace** (**查询参数**):string,必需
}}">namespace
- **body**: }}">Event,必需
- **dryRun** (**查询参数**):string
}}">dryRun
- **fieldManager** (**查询参数**):string
}}">fieldManager
- **fieldValidation** (**查询参数**):string
}}">fieldValidation
- **pretty** (**查询参数**):string
}}">pretty
#### 响应
200 (}}">Event): OK
201 (}}">Event): Created
202 (}}">Event): Accepted
401: Unauthorized
### `update` 替换指定 Event
#### HTTP 请求
PUT /apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}
#### 参数
- **name** (**路径参数**):string,必需
Event 名称
- **namespace** (**路径参数**):string,必需
}}">namespace
- **body**:}}">Event,必需
- **dryRun** (**查询参数**):必需
}}">dryRun
- **fieldManager** (**查询参数**):string
}}">fieldManager
- **fieldValidation** (**查询参数**):string
}}">fieldValidation
- **pretty** (**查询参数**):string
}}">pretty
#### 响应
200 (}}">Event): OK
201 (}}">Event): Created
401: Unauthorized
### `patch` 部分更新指定的 Event
#### HTTP 请求
PATCH /apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}
#### 参数
- **name** (**路径参数**):string,必需
Event 名称
- **namespace** (**路径参数**):string,必需
}}">namespace
- **body**: }}">Patch,必需
- **dryRun** (**查询参数**):string
}}">dryRun
- **fieldManager** (**查询参数**):string
}}">fieldManager
- **fieldValidation** (**查询参数**):string
}}">fieldValidation
- **force** (**查询参数**):boolean
}}">force
- **pretty** (**查询参数**):string
}}">pretty
#### 响应
200 (}}">Event): OK
201 (}}">Event): Created
401: Unauthorized
### `delete` 删除 Event
#### HTTP 请求
DELETE /apis/events.k8s.io/v1/namespaces/{namespace}/events/{name}
#### 参数
- **name** (**路径参数**):string,必需
Event 名称
- **namespace** (**路径参数**):string,必需
}}">namespace
- **body**: }}">DeleteOptions
- **dryRun** (**查询参数**):string
}}">dryRun
- **gracePeriodSeconds** (**查询参数**):integer
}}">gracePeriodSeconds
- **pretty** (**查询参数**):string
}}">pretty
- **propagationPolicy** (**查询参数**):string
}}">propagationPolicy
#### 响应
200 (}}">Status): OK
202 (}}">Status): Accepted
401: Unauthorized
### `deletecollection` 删除 Event 集合
#### HTTP 请求
DELETE /apis/events.k8s.io/v1/namespaces/{namespace}/events
#### 参数
- **namespace** (*in path*):string,必需
}}">namespace
- **body**: }}">DeleteOptions
- **continue** (**查询参数**):string
}}">continue
- **dryRun** (**查询参数**):string
}}">dryRun
- **fieldSelector** (**查询参数**):string
}}">fieldSelector
- **gracePeriodSeconds** (**查询参数**):integer
}}">gracePeriodSeconds
- **labelSelector** (**查询参数**):string
}}">labelSelector
- **limit** (**查询参数**):integer
}}">limit
- **pretty** (**查询参数**):string
}}">pretty
- **propagationPolicy** (**查询参数**):string
}}">propagationPolicy
- **resourceVersion** (**查询参数**):string
}}">resourceVersion
- **resourceVersionMatch** (*查询参数*):string
}}">resourceVersionMatch
- **timeoutSeconds** (**查询参数**):integer
}}">timeoutSeconds
#### 响应
200 (}}">Status): OK
401: Unauthorized