When I do a kubectl describe <pod>
, the bottom section has an "Events" section, displaying Events related to that pod. For example, an event with Reason "failedScheduling", with the message "Failed for reason PodFitsResources and possibly others"
How can I query the API to return that list of events?
If I call /api/v1/namespaces/<ns>/pods/<pod_name>
, it doesn't return any Events. If I try the /api/v1/events
endpoint, I can specify a labelSelector
parameter, but the name of the pod isn't a label of the Event, though it is in the object.involvedObject.name
field.
I could request the entire Event stream and filter out the few Events that interest me client-side, but that seems like overkill. kubectl
is able to do it, so I figure there must be some way that I'm missing.
Thanks.
I think events support a fieldSelector for the involved object kind and name
You can also turn the verbosity level on kubectl up to 8 to see network traces to see what it is doing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With