liveBook · Manning

Event

As explained in Kubernetes in Action, Second Edition

A Kubernetes Event is an API object that records an occurrence or state transition involving a cluster object.

A Kubernetes Event is an API object that records something that happened to a cluster object. Controllers create events while reconciling desired and actual state, making recent actions and problems visible. section 4.3 section 4.3.1

Events are separate objects rather than fields inside the affected object’s manifest. They commonly describe Nodes, Pods, and other API objects, and they help explain why an object is not working as expected. section 4.3.1 section 4.4

Inspect events with kubectl and interpret their main fields:

  • Run kubectl get events, or use the short resource name kubectl get ev, to list recent events. section 4.3.1
  • Use kubectl describe on a Pod, Node, or other object to view related events in a readable diagnostic view. section 5.2.3 section 4.2.4
  • Read Type as Normal or Warning, Reason as a machine-facing cause, Source as the reporting component, and Message as the human-facing explanation. section 4.3.1
  • Use First seen, Last seen, and Count to understand repeated occurrences; events may be deleted after about one hour, depending on API-server configuration. section 4.3.1
Figure 4.7 The relationship between Event objects, controllers, and other API objects
figure

Use the relationship diagram to trace how controllers act on API objects and emit Events describing those actions. section 4.3

Following a Pod’s startup

After creating the kiada Pod, kubectl get events can show a chronological sequence: the Pod is scheduled, its image is pulled, the container is created, and the container is started. The absence of Warning events indicates that this startup path completed normally. section 5.2.3

$ kubectl get events
LAST SEEN   TYPE     REASON      OBJECT      MESSAGE
<unknown>   Normal   Scheduled   pod/kiada   Successfully assigned default/
                                             kiada to kind-worker2
5m          Normal   Pulling     pod/kiada   Pulling image luksa/kiada:0.1
5m          Normal   Pulled      pod/kiada   Successfully pulled image
5m          Normal   Created     pod/kiada   Created container kiada
5m          Normal   Started     pod/kiada   Started container kiada

Use the command output to recognize the normal scheduling, image-pull, creation, and startup events associated with a Pod. section 5.2.3

Event objects do not have spec or status sections, and their fields can appear alphabetically in returned YAML. Usually, kubectl get events and kubectl describe provide the useful operational view. section 4.3.2

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains event types, fields, lifecycle, retention, commands, and YAML limitations, but stops short of event creation internals.
Examples
Uses Node startup events and a Pod sequence covering scheduling, image pulling, container creation, and container startup.
What it assumes
Assumes familiarity with Kubernetes API objects, controllers, and kubectl while introducing event inspection through concrete Nodes and Pods.
What you can do after
Diagnose/debug with it by listing events, filtering Warnings, reading fields, and tracing an object’s recent lifecycle.
How it connects
Connects Events with Kubernetes API objects, controllers, desired state, Nodes, Pods, object status, and kubectl.

Also explained in

Compare how 18 books explain event →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.