Created
July 9, 2020 14:08
-
-
Save rymcol/fba53b7183020887d64abc6705e9dcfd to your computer and use it in GitHub Desktop.
just a handy fish function to make logs [app] [namespace] find a pod that matches metadata.app=[app] in [namespace] and produce logs for it
This file contains hidden or 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
| function logs | |
| if test (count $argv) -ge 2 | |
| set app $argv[1] | |
| set namespace $argv[2] | |
| else | |
| echo "You must provide two arguments… `logs [app] [namespace]`" | |
| return 2 | |
| end | |
| kubectl logs (kubectl get pods -l app=$app -o jsonpath="{.items[0].metadata.name}" -n $namespace) -n $namespace -f | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In bash this would be something close to
alias logs='kubectl logs (kubectl get pods -l app=$1 -o jsonpath="{.items[0].metadata.name}" -n $2) -n $2 -f'