Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Analyze Kubernetes events with kubectl events

By updated

Improve this page

Logo Kubernetes

Events report what has just happened in your Kubernetes cluster, but they are not a history: they expire after about an hour. Every pod creation, scheduling error, probe failure or eviction generates an event. This guide shows you how to read, filter and use these events with kubectl events and kubectl get events to detect anomalies before they turn into incidents.

What you will learn

  • Understand what a Kubernetes Event is and its essential fields
  • Use kubectl events to filter by type, resource and namespace
  • Recognize common event patterns (Normal and Warning)
  • Use the Events shown by kubectl describe for diagnosis
  • Understand event retention and its implications

Prerequisites

What is a Kubernetes Event?

An Event is an API object that describes something that happened in the cluster. Kubernetes components (kubelet, scheduler, controller-manager) create Events to report normal operations and anomalies.

Each Event contains the fields below, named as in the modern form of the API, events.k8s.io/v1 (the section on YAML output explains that another form exists):

FieldWhat it indicates
typeNormal (expected operation) or Warning (anomaly detected)
reasonShort code identifying the event (Scheduled, BackOff, FailedMount...)
noteHuman-readable description of what happened
regardingThe resource concerned (pod, node, deployment...)
reportingControllerThe component that created the event (kubelet, scheduler...)
eventTimeMain timestamp of the event
series.countNumber of repetitions if the event is aggregated
series.lastObservedTimeLast observed occurrence of this series

What is the difference between Normal and Warning events?

Kubernetes defines only two types of events:

  • Normal reports an expected operation: a pod was scheduled, an image was pulled, a container started. These events confirm that the cluster works.
  • Warning reports an anomaly: a scheduling failed, a volume cannot be mounted, a probe failed. These events point to a problem to investigate.

In operations, the Warning events are the ones that deserve your attention. The Normal ones help you rebuild the timeline when you diagnose an incident.

How do I read events with kubectl events?

The kubectl events subcommand offers a more readable display and dedicated filters, which kubectl get events does not have. It is the command to use when exploring events.

How do I list all Warning events in the cluster?

Terminal window
kubectl events -A --types=Warning

The -A option (or --all-namespaces) covers the whole cluster. --types=Warning filters only the anomalies.

How do I filter by resource?

The --for option targets a specific resource:

Terminal window
# Events of a pod
kubectl events -n default --for=pod/mon-pod
# Events of a node
kubectl events --for=node/ks-worker1
# Events of a deployment
kubectl events -n default --for=deployment/mon-deployment

How do I follow events in real time?

The --watch flag displays new events as they arrive:

Terminal window
kubectl events -A --types=Warning --watch

Use it during a maintenance window or a deployment: anomalies appear as they happen.

How do I get the full detail in YAML?

To see all the fields of an event:

Terminal window
kubectl events -A -o yaml | head -60

The same event nevertheless exists in two forms, with different field names, and this explains many fruitless searches. The command above returns the historical form, apiVersion: v1:

apiVersion: v1
involvedObject: count: firstTimestamp:
source: message: lastTimestamp:

The modern form, events.k8s.io/v1, must be requested explicitly and renames everything:

Terminal window
kubectl get events.events.k8s.io -A -o yaml | head -60
apiVersion: events.k8s.io/v1
regarding: note: eventTime:
reportingController: deprecatedCount: deprecatedLastTimestamp:

The mapping is direct: involvedObject becomes regarding, message becomes note, source becomes reportingController. The old names survive in the new API, prefixed with deprecated (like deprecatedCount). A series field also appears, but only on an event that repeats: on a quiet cluster, do not look for it.

The practical consequence: a jsonpath written for one form does not work on the other. involvedObject.name returns nothing in events.k8s.io/v1, where you must write regarding.name.

How do I read events with kubectl get events?

The classic kubectl get events command remains useful for filtering by field with --field-selector:

Terminal window
# Warning events only
kubectl get events -A --field-selector type=Warning
# Events of a specific object
kubectl get events -n default --field-selector involvedObject.name=mon-pod
# Combine filters
kubectl get events -A --field-selector type=Warning,reason=FailedScheduling

Many examples online sort with --sort-by=.lastTimestamp or --sort-by=.metadata.creationTimestamp. These fields belong to the historical model, the one that events.k8s.io/v1 files under the deprecated prefix. They still work and nothing urges you to replace them in a script that runs. kubectl events nevertheless spares you from choosing: its filters rely on the modern model.

How do I see events in kubectl describe?

The kubectl describe command displays the events related to a resource in its Events section at the bottom of the output. It is often the first thing to read when diagnosing a pod:

Terminal window
kubectl describe pod mon-pod -n default

The Events section at the bottom looks like this:

Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m default-scheduler Successfully assigned default/mon-pod to ks-worker1
Normal Pulling 2m kubelet Pulling image "nginx:1.27"
Normal Pulled 118s kubelet Successfully pulled image "nginx:1.27"
Normal Created 118s kubelet Created container nginx
Normal Started 118s kubelet Started container nginx

This sequence shows the normal lifecycle of a pod: scheduling → image pull → container creation → start.

kubectl describe node displays the events related to a node in the same way (evictions, kubelet problems, resource pressure).

kubectl describe presents a condensed view of the events related to the resource, without exposing all the fields of the events.k8s.io/v1 model, such as reportingController or series. To see them, request the modern form: kubectl get events.events.k8s.io -o yaml (see the YAML output section above).

Which event patterns are common?

The reason values in the two tables below come up regularly. Knowing them by sight saves time: you skim the normal lines and stop on the ones that are not.

Normal events (expected operations)

These events tell the normal lifecycle of a pod, from placement to start. Seeing them in this order is a sign that all is well. The place where the sequence stops points to the failing step.

ReasonSourceWhat it means
ScheduledschedulerThe pod was assigned to a node
PullingkubeletThe image pull has started
PulledkubeletThe image was pulled (or was already cached)
CreatedkubeletThe container was created
StartedkubeletThe container started
ScalingReplicaSetdeployment-controllerA Deployment adjusted the number of replicas
SuccessfulCreatereplicaset-controllerA ReplicaSet created a pod
KillingkubeletThe container is being stopped (rolling update, deletion)

Warning events (anomalies to investigate)

ReasonSourceWhat it meansAction
FailedSchedulingschedulerNo node can host the podCheck requests, taints, affinity, node capacity
BackOffkubeletThe container crashed and Kubernetes waits before restarting itCheck the logs: kubectl logs --previous
FailedMountkubeletA volume could not be mountedCheck the PVC, the StorageClass, the permissions
FailedAttachVolumeattachdetach-controllerThe volume could not be attached to the nodeCheck the storage provider and the volume state
UnhealthykubeletA liveness or readiness probe failedCheck the probe configuration and the application state
EvictedkubeletThe pod was evicted (node memory/disk pressure)Check the node conditions, adjust resources
NodeNotReadynode-controllerA node lost contact with the control planeCheck the kubelet and the node network
FailedCreatereplicaset-controllerThe ReplicaSet could not create a podCheck quotas, RBAC, or admission errors

You read this repetition directly in kubectl events and in kubectl describe: the age column then shows, for example, 8m22s (x1321 over 73m). The event occurred 1321 times in 73 minutes, and its last occurrence was 8 minutes 22 seconds ago.

How long does Kubernetes keep events?

By default, the API server keeps Events for 1 hour through the --event-ttl=1h0m0s parameter. After that, they are deleted automatically. Events are therefore useful for immediate diagnosis, but not as a history system.

What this implies:

  • Events are not a monitoring system: they disappear. To keep a history, export them to a log system (Elasticsearch, Loki, etc.)
  • If an incident happened more than an hour ago, the Events have probably disappeared. You will have to rely on component logs or on a centralization tool

The reason for this short TTL is storage: Events live in the Kubernetes API, therefore in etcd, just like your Deployments. On a very busy cluster, they can represent a significant share of etcd writes, which is why they are not kept. If incident history matters to you, it is therefore not the TTL that you should lengthen, it is an export to a log system that you should set up.

Practical example: diagnose with Events

Here is a typical scenario. A colleague reports that an application no longer responds. You start with the Events:

  1. Check the namespace's recent Warnings:

    Terminal window
    kubectl events -n mon-app --types=Warning

    Result: several BackOff events on the pod api-server-xyz.

  2. Target the pod's events:

    Terminal window
    kubectl events -n mon-app --for=pod/api-server-xyz

    The sequence shows: Started → BackOff → Started → BackOff in a loop. The container crashes in a loop.

  3. Complete with the logs:

    Terminal window
    kubectl logs api-server-xyz -n mon-app --previous --tail=30

    The logs reveal a database connection error.

  4. Check the Events of the database Pod:

    Terminal window
    kubectl events -n mon-app --for=pod/postgres-0

    An Evicted event appears: the PostgreSQL pod was evicted because of memory pressure on the node.

In four commands, the events made it possible to trace back to the cause: eviction of the database Pod, then a connection error in the API, then a restart loop.

Troubleshooting

The first four symptoms below are about difficulty finding or reading the events; the last two describe events that repeat. An empty list is confusing: it looks like an absence of problems, when it often means that you are looking in the wrong place, or too late.

SymptomLikely causeSolution
kubectl events returns error: unknown commandkubectl version < 1.26Update kubectl, or use kubectl get events
No events displayedEvents expired (TTL exceeded)Start observing again, Events only persist for ~1h
Too many events, hard to find the informationBusy cluster without filteringUse --types=Warning, --for=<resource> or --field-selector
Events visible in describe but not in kubectl eventsNamespace or timing differenceCheck the namespace with -n, both commands read the same objects
FailedScheduling Warning looping without resolutionInsufficient resources on all nodeskubectl describe pod for details, add a node or adjust the requests
Repeated events, increasing counter (x1321 over 73m)Persistent unresolved problemFix the root cause (the counter only indicates repetition)

Hands-on practice

The previous sections show how to read Events by hand. This lab puts you in front of a boutique namespace that hosts five applications, four of which are broken, each in a different way. You repair nothing: you read the namespace's Events, then write the incident report in the rapport ConfigMap. It gives the reason for the Warning Events of each broken application, names the healthy one and identifies the first application hit.

The validation checks three requirements: each broken application carries the reason of its Warning Events word for word, the application with no Warning Event at all is called healthy, and the report names the application hit by the first Warning Event of the namespace. For the last requirement, you need to sort the Events by date: the section on kubectl get events shows the sorting options. Events expire after about an hour (retention section): read them without waiting once the lab has started.

Key takeaways

  • Read the Events before the logs: they say what Kubernetes did (or tried to do). They are immediate signals, not a complete history
  • kubectl events -A --types=Warning lists all the cluster's anomalies in a single command
  • An Event is either Normal or Warning: Normal reports an expected operation, Warning an anomaly
  • Repetition matters more than occurrence: an isolated Warning is often harmless, a Warning that repeats signals a real problem
  • Events disappear after ~1 hour: they do not replace a monitoring system. For a history, centralize them in a log tool
  • kubectl describe displays a resource's Events at the bottom of its output, which is often enough to diagnose a specific resource
  • The same event exists in two forms (v1 and events.k8s.io/v1) with different field names: a jsonpath written for one does not work on the other

Knowledge check

Seven questions on what trips readers up: the two sets of field names of the same event, how to read a repetition counter, and what an empty Events section really means.

Knowledge check

Check what you have learned with this interactive quiz

7 questions
5 min
80% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer