Last active
January 18, 2023 14:33
-
-
Save noamtamim/60f92567f4e259d9147d2c972982d60f to your computer and use it in GitHub Desktop.
kubectl shortcuts
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
# Source this file to use | |
_podget() { | |
kubectl --namespace $NS get pods | |
} | |
_podnames() { | |
_podget | tail -n +2 | cut -d " " -f1 | |
} | |
_podname() { | |
_podnames | grep $1 | head -n1 | |
} | |
_podsh() { | |
kubectl --namespace $NS exec -it `_podname $1` -- sh | |
} | |
_podtop() { | |
kubectl --namespace $NS exec -it `_podname $1` -- top | |
} | |
_podinfo() { | |
kubectl --namespace $NS exec -it `_podname $1` -- cat package.json | |
} | |
_podlogs() { | |
kubectl --namespace $NS logs --tail 100 -f `_podname $1` | |
} | |
_poddesc() { | |
kubectl --namespace $NS describe pod `_podname $1` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source directly from gist:
curl -L https://gist.github.com/noamtamim/60f92567f4e259d9147d2c972982d60f/raw/11a3589949230eb6659824096f9502b9877a2867/kube.sh | source /dev/stdin