Skip to content

Instantly share code, notes, and snippets.

@cnnrrss
Created August 18, 2024 05:02
Show Gist options
  • Save cnnrrss/8ccfd53f70846de469a05d4b41380ccc to your computer and use it in GitHub Desktop.
Save cnnrrss/8ccfd53f70846de469a05d4b41380ccc to your computer and use it in GitHub Desktop.
fzf tail all pods
pods() {
command='kubectl get pods --all-namespaces' fzf \
--info=inline --layout=reverse --header-lines=1 \
--prompt "$(kubectl config current-context | sed 's/-context$//')> " \
--header $'╱ Enter (kubectl exec) ╱ CTRL-O (open log in editor) ╱ CTRL-R (reload) ╱\n\n' \
--bind 'start:reload:$command' \
--bind 'ctrl-r:reload:$command' \
--bind 'ctrl-/:change-preview-window(80%,border-bottom|hidden|)' \
--bind 'enter:execute:kubectl exec -it --namespace {1} {2} -- bash' \
--bind 'ctrl-o:execute:${EDITOR:-vim} <(kubectl logs --all-containers --namespace {1} {2})' \
--preview-window up:follow \
--preview 'kubectl logs --follow --all-containers --tail=10000 --namespace {1} {2}' "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment