Skip to content

Instantly share code, notes, and snippets.

@luckylittle
Created December 3, 2020 02:18
Show Gist options
  • Save luckylittle/77319645f916e2614d8b4680712f6012 to your computer and use it in GitHub Desktop.
Save luckylittle/77319645f916e2614d8b4680712f6012 to your computer and use it in GitHub Desktop.
Probably the most important command for OpenShift troubleshooting
oc get events --sort-by='.lastTimestamp' --all-namespaces
@luckylittle
Copy link
Author

Note: The above command may fail with e.g.:
F0217 11:01:54.522792 9679 sorter.go:353] Field {.lastTimestamp} in [][][]reflect.Value is an unsortable type: interface, err: unsortable interface: interface
This is caused by the fact that some events have <unknow> or <invalid> LAST SEEN timestamp.

This should work in such cases:
oc get events --sort-by='.metadata.creationTimestamp' --all-namespaces

@luckylittle
Copy link
Author

Another useful commands for troubleshooting:

  • oc get pods -A | grep -v "Running\|Completed\|Terminated\|Succeeded" - shows only problematics pods
  • oc get clusterversion && echo && oc get co && echo && oc get nodes -o wide - general cluster status/health

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment