Created
January 6, 2017 12:23
-
-
Save countless-integers/a7ed51700317b2809895d1eb5d71b9ed to your computer and use it in GitHub Desktop.
tail logs from kubernetes pod
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 | |
podId=$(kubectl get pod -o name | \ | |
grep --color=never -o -E \ | |
"\/.*$(echo $@ | tr '_ ' '.').*" \ | |
) | |
podId=$(echo $podId | sed 's/ .*//g' | tr -d '/') | |
echo Showing logs from $podId | |
kubectl logs $podId --tail=20 -f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment