I'm troubleshooting liveness probe failures. I'm able to extract specific entries from k8s event using this approach
k get events --sort-by=.metadata.creationTimestamp | grep Liveness
I'd like to get only the pod(s) that causing the issue.
I'm considering to pipe a cut, but I'm not sure which delimiter should I use to get the specific column.
Where I can find the delimiter related to that specific k8s resource(Events) used to printout the kubectl output?
Any other suggestion is appreciated
UPDATE so far these are the best options (w/o using extra tools) satisfying my specific needs:
k get events -o jsonpath='{range .items[*]}{.involvedObject.name}/{.involvedObject.namespace}: {.message}{"\n"}{end}' | grep Liveness
k get events -o custom-columns=POD:.involvedObject.name,NS:.involvedObject.namespace,MGG:.message | grep Liveness
there is a feature in kubernetes called jsonpath
validate if your jsonpath is correct with this online tool: https://jsonpath.com/
easily go through json keys with this online tool, so you needn't manually type the key names any more): http://jsonpathfinder.com/
so your command will be:
k get events --sort-by=.metadata.creationTimestamp --jsonpath '{ .xxxxxx }'