List Events for Pod using client-go in readable format

1/17/2022

I am using the below client-go function to list the events for a particular pod in a specified namespace.

events, _ := clientset.CoreV1().Events("namespaceName").List(context.TODO(), metav1.ListOptions{FieldSelector: "involvedObject.name=podName", TypeMeta: metav1.TypeMeta{Kind: "Pod"}})

The output is not in a readable format and don't have readable structure like the output of

kubectl get events -n namespace

Is there a way to get the same output of events but using client-go instead of kubectl??

-- Akash
client-go
go
kubernetes

0 Answers