CODEX

Break down Kubernetes Events Internally

Understand Events structure and walk through how they are generated

Stefanie Lai
CodeX
Published in
6 min readMar 25, 2021

--

Image from Unsplash @bizarretribe

kubectl get events --namespace {name}

It is considered one of the essential CLI commands for debugging the objects in the cluster. We can usually solve the simple issues with kubectl get pod or kubectl logs pod xxx. But what if both of them are limited? Events objects are what we seek to first to race the problem.

Just like Pod, Deployment, and ConfigMap, events are also one type of resource objects of Kubernetes, not tied to Pod like logs. But why we fail to get a result when we try to find the corresponding Pod events through kubectl get events {eventName} --namespace? And is there a way to use kubectl get events to get the relevant information through the resource name in CLI? Let’s understand the necessity of events and analyze its design architecture first, then reveal the answer.

What is an Event?

Let’s run kubectl explain events to find out more.

Event is one of the cluster-type resource objects, which we can access through REST APIs provided by APIServer.

Create Event: POST /api/v1/namespaces/{namespace}/eventsUpdate Event: PATCH…

--

--