Last active
November 14, 2015 10:38
-
-
Save pjvds/32289ab813b02977f15f to your computer and use it in GitHub Desktop.
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 | |
matches=( `kubectl get pods | tail -n +2 | grep "$1" | awk '{print $1}'` ) | |
count=${#matches[@]} | |
if [[ $count -eq 0 ]]; then | |
echo "no match!" | |
exit 1 | |
fi | |
if [[ $count -gt 1 ]]; then | |
echo "multiple matches:" | |
echo "$matches" | |
exit 1 | |
fi | |
kubectl logs $matches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment