OpenShift - Delete events using the oc delete events command

by
Jeremy Canfield |
Updated: September 06 2022
| OpenShift articles
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 the list the recent events in your currently selected project / namespace.
oc get events
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 oc delete events --all command can be used to clear all of the events in your currently selected project / namespace. All of the events that were deleted should be listed.
~]# oc delete events --all
event "my-hello-world-image-1-deploy.17123431f4afdb14" deleted
event "my-hello-world-image-1-deploy.17123432854132fd" deleted
event "my-hello-world-image-1-deploy.171234328d9dfd8d" deleted
event "my-hello-world-image-1-deploy.1712343297a3b0a8" deleted
event "my-hello-world-image-1-deploy.171234329908b8ec" deleted
event "my-hello-world-image-1-deploy.1712347f3fcdb40a" deleted
event "my-hello-world-image-1-xtmsv.17123432a13ee534" deleted
event "my-hello-world-image-1-xtmsv.17123433135b84b4" deleted
event "my-hello-world-image-1-xtmsv.171234331e689808" deleted
event "my-hello-world-image-1-xtmsv.1712344f12ee053a" deleted
event "my-hello-world-image-1-xtmsv.1712344f12ee3d51" deleted
event "my-hello-world-image-1-xtmsv.1712344f25aa7c46" deleted
event "my-hello-world-image-1-xtmsv.1712344f25aa9f27" deleted
event "my-hello-world-image-1.17123432a09ae02f" deleted
event "my-hello-world-image.17123431f18682c2" deleted
Now the oc get events command should return the following.
~]# oc get events
No resources found in default namespace.
Did you find this article helpful?
If so, consider buying me a coffee over at