Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bpd1069/fe128d6d399b0f1fffedc88202ec81c6 to your computer and use it in GitHub Desktop.
Save bpd1069/fe128d6d399b0f1fffedc88202ec81c6 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