kubectl get events only for a pod

Rakesh N picture Rakesh N · Aug 20, 2018 · Viewed 46k times · Source

When I run kubectl -n abc-namespace describe pod my-pod-zl6m6, I get a lot of information about the pod along with the Events in the end.

Is there a way to output just the Events of the pod either using kubectl describe or kubectl get commands?

Answer

mszalbach picture mszalbach · Aug 20, 2018

You can use the event command of kubectl.

To filter for a specific pod you can use a field-selector:

kubectl get event --namespace abc-namespace --field-selector involvedObject.name=my-pod-zl6m6

To see what fields are possible you can use kubectl describe on any event.