Skip to content

Instantly share code, notes, and snippets.

@zepptron
Created June 19, 2018 08:34
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zepptron/9635568b9d90d858daca7780feb8c4b7 to your computer and use it in GitHub Desktop.
Save zepptron/9635568b9d90d858daca7780feb8c4b7 to your computer and use it in GitHub Desktop.
.bashrc & .zshrc: usefull kubectl + fzf
podlog () {
local pod=($(kubectl get pods --all-namespaces -o wide | fzf | awk '{print $1, $2}'))
echo kubectl logs -n ${pod[1]} ${pod[2]}
kubectl logs -n ${pod[1]} ${pod[2]}
}
podexec () {
local pod=($(kubectl get pods --all-namespaces -o wide | fzf | awk '{print $1, $2}'))
local cmd=${@:-"/bin/sh"}
echo kubectl exec -it --namespace ${pod[1]} ${pod[2]} $cmd
kubectl exec -it --namespace ${pod[1]} ${pod[2]} $cmd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment