OpenShift - List Events using the oc get events command

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get events command can be used to list the recent events in your currently selected project / namespace.

TIP

The -A or --all-namespaces flag can be used to list the events in every project / namespace.

The -n or --namespace flag can be used to list the events in a certain project / namespace.

oc get events

 

Or, you can use the -n or --namespace option followed the the project name.

oc get events --namespace my-project

 

If there are no recent events, something like this should be displayed.

No resources found in foo namespace.

 

On the other hand, if there are events, something like this should be displayed.

LAST SEEN   FIRST SEEN   COUNT     NAME                                                             KIND      SUBOBJECT                        TYPE      REASON      SOURCE              MESSAGE
53m         1d           162       mypod001-0.0.5-master-2-2-7db7cccc54-x4lql.162212ee500ec2d5      Pod       spec.containers{mypod001}        Warning   Unhealthy   kubelet, server01   Readiness probe failed: HTTP probe failed with statuscode: 503

 

The -o wide option can be used to display additional fields.

oc get events -o wide

 

Which should add the SUBOBJECT field.

LAST SEEN   FIRST SEEN   COUNT     NAME                                                             KIND      OBJECT     SUBOBJECT                        TYPE      REASON      SOURCE              MESSAGE
53m         1d           162       mypod001-0.0.5-master-2-2-7db7cccc54-x4lql.162212ee500ec2d5      Pod       pod/pod001 spec.containers{mypod001}        Warning   Unhealthy   kubelet, server01   Readiness probe failed: HTTP probe failed with statuscode: 503

 

By default, the events are not sorted. Here is how the events can be sorted using creationTimestamp.

oc get events --sort-by='.metadata.creationTimestamp'

 

Or like this, using lastTimestamp.

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

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter f291f in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |