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?
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.
You can use the event command of kubectl . To see what fields are possible you can use kubectl describe on any event.
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.
kubectl get events --sort-by='.lastTimestamp'
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