LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

kubectl-events

lists cluster events

TLDR

Show events in the current namespace
$ kubectl events
copy
Show events in a specific namespace
$ kubectl events -n [namespace]
copy
Show events across all namespaces
$ kubectl events -A
copy
Events scoped to a specific resource
$ kubectl events --for [pod/pod-name]
copy
Watch live events as they arrive
$ kubectl events --watch
copy
Only Warnings (filter by event type)
$ kubectl events --types=[Warning]
copy
Sort events chronologically (oldest first)
$ kubectl events --sort-by=[lastTimestamp]
copy
Output as JSON
$ kubectl events -o json
copy

SYNOPSIS

kubectl events [options]

DESCRIPTION

kubectl events is the modern, dedicated subcommand for listing Kubernetes Event objects. It was added as an alpha in kubectl 1.23 and promoted to GA in 1.27, replacing the older kubectl get events form with a cleaner default output and live-watch support.Events are short-lived records emitted by controllers (kubelet, scheduler, controller-manager, custom operators, ...) that describe noteworthy state changes such as pod scheduling, image pulls, liveness-probe failures, or HPA scaling decisions. Use --for to follow a specific Pod, Deployment, or Job, --watch for live debugging, and --sort-by to put the most recent events at the bottom for chronological reading.

PARAMETERS

-n NAMESPACE

Target namespace (default: current context's namespace).
-A, --all-namespaces
List events from every namespace.
--for KIND/NAME
Restrict to events whose involvedObject matches the given resource (e.g. pod/web-0).
--watch, -w
Stream new events instead of exiting after one snapshot.
--types TYPES
Comma-separated event types (Normal, Warning).
--sort-by FIELD
Sort by a JSONPath field, typically .lastTimestamp or .metadata.creationTimestamp.
-o FORMAT
Output format (wide, json, yaml, jsonpath, ...).
--no-headers
Suppress the column header line.
--help
Display help information.

CAVEATS

Events expire after --event-ttl (default 1 hour); historical incidents need an external aggregator (Loki, Elasticsearch, Datadog) or persistent storage of the Events API. The --for flag is exact: events emitted on a parent resource (Deployment) are not surfaced when watching the child Pod. kubectl events is a separate plugin in some older distributions; on those, fall back to kubectl get events.

HISTORY

kubectl events landed as an alpha command in Kubernetes 1.23 (December 2021), became beta in 1.25, and reached general availability in 1.27 (April 2023). It was contributed to consolidate the various flags previously needed on kubectl get events to make ad-hoc cluster debugging more ergonomic.

SEE ALSO

Copied to clipboard
Kai