Skip to content

Instantly share code, notes, and snippets.

@pjvds
Last active November 14, 2015 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjvds/32289ab813b02977f15f to your computer and use it in GitHub Desktop.
Save pjvds/32289ab813b02977f15f to your computer and use it in GitHub Desktop.
#!/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