Last active
February 2, 2023 21:24
-
-
Save gswallow/ff53998ad13007652182975e662481a5 to your computer and use it in GitHub Desktop.
Get events by pod name (or a fragment thereof)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pod_name=$1 | |
while true; do | |
kubectl get events --sort-by='.lastTimestamp' \ | |
-ojson \ | |
| jq -r '.items[] | select((.involvedObject.name | contains("'$pod_name'")) and (.involvedObject.kind=="Pod")) | "\(.lastTimestamp) [\(.count)] \(.message)"' | |
echo | |
echo "---------" | |
echo | |
sleep 2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment