Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What kubectl command can I use to get events sorted by specific fields and print only specific details of events?

I need to print only specific fields of Kubernetes Events, sorted by a specific field.

This is to help me gather telemetry and analytics about my namespace

How could I do that?

like image 260
suryakrupa Avatar asked Jul 20 '17 23:07

suryakrupa


People also ask

How do you sort events in kubectl?

To sort events by time using kubectl, login into the Ubuntu 20.04 system. After that, navigate the command line terminal by searching in either application or using the “Ctrl+Alt+T” shortcut key. Once opened, start the minikube cluster in it by executing the cited below command in the terminal shell.

Which command can be used to display the events for a pod?

You can use the event command of kubectl . To see what fields are possible you can use kubectl describe on any event.

Which of the following command is used to get detailed information of a Kubernetes cluster?

kubectl get − This command is capable of fetching data on the cluster about the Kubernetes resources. kubectl logs − They are used to get the logs of the container in a pod.


1 Answers

kubectl get events --sort-by='.lastTimestamp'

like image 119
ehbello Avatar answered Sep 27 '22 18:09

ehbello