Bartosz Bierkowski - Low dose cloud

OpenShift Morsels: troubleshooting with events

On Day #4 lets have a look at the events. They let you learn about changes taking place in your project in relation to OpenShift.

Why does the pod not start? Is there no node for it? Is there not enough CPU, memory? Are there some errors that cause it to restart constantly. Ok, maybe you will not learn all answers from getting events, but they could serve a good hint.

After running oc get events you will see a shorter or longer list with quite a few details.

The event is nicely split into columns. Names and kinds of resources that were affected. These are Pod, DeploymentConfig, ReplicationController in the example above. Reason for the event and detailed message. And it looks like the events are finally sorted by time – which was not the case in the past.

I think the most interesting thing about them is that they are normal OpenShift objects. It is no longer just a text like in the case of logs. Each object can be identified and extracted or processed.

You can get single event information. Not sure if you would use it for anything, but it is a good demonstration that it is still an object.

oc describe event <event-name>  does not return any useful information. At least not for now.

Since they are objects, it also means that you can export them to yaml or json for some processing with oc get events -o json .

And if you are into programming, you can create new events in case you have some additional controller or application that interacts with OpenShift APIs. Or you can watch them and react automatically to interesting events.

Events are not replacements for logs. They are not persisted for a long time – by default just 1h.

Documentation

The official OpenShift documentation nicely list all kinds of events that may occur in the system at the moment: https://docs.openshift.org/3.6/dev_guide/events.html

Environment

The commands were executed using minishift and the following client/server versions of OpenShift.

Client:
oc v3.6.1+008f2d5
client kubernetes v1.6.1+5115d708d7
Server:
openshift v3.6.0+c4dd4cf
server kubernetes v1.6.1+5115d708d7

Newsletter

Thanks for reading the OpenShift morsels. To get updates about new articles, you can sign up to the newsletter below.

As a thank you message, you will also get access to OpenShift CLI CheatSheet listing most commonly used commands together with a short explanation.

Did you like the article?
Join the newsletter to receive notifications about new articles.
I respect your privacy.