Skip to content

Instantly share code, notes, and snippets.

@noamtamim
Last active January 18, 2023 14:33
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 noamtamim/60f92567f4e259d9147d2c972982d60f to your computer and use it in GitHub Desktop.
Save noamtamim/60f92567f4e259d9147d2c972982d60f to your computer and use it in GitHub Desktop.
kubectl shortcuts
# 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`
}
@noamtamim
Copy link
Author

noamtamim commented Jan 2, 2023

Source directly from gist:

curl -L https://gist.github.com/noamtamim/60f92567f4e259d9147d2c972982d60f/raw/11a3589949230eb6659824096f9502b9877a2867/kube.sh | source /dev/stdin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment