Last active
February 26, 2023 23:20
-
-
Save terinjokes/7d2a2f85bc7e89541c8cecabacec50b4 to your computer and use it in GitHub Desktop.
FZF function for Kubernetes logs (including previewing)
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
klogs() { | |
pod="$(kubectl get po -o wide|tail -n+2|fzf -n1 --reverse --tac --preview='kubectl logs --tail=20 --all-containers=true {1}' --preview-window=down:50%:hidden --bind=ctrl-p:toggle-preview --header="^P: Preview Logs"|awk '{print $1}')" | |
if [[ -n $pod ]]; then | |
kubectl logs --all-containers=true $pod | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment