Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FZF usage examples

GKE

Get credentials for a given GKE cluster

gcloud container clusters get-credentials $(gcloud container clusters list --format json | jq -r '.[] | "\(.name) --zone \(.location)"' | fzf --height 10 --sync)

Kubernetes

Switch to a new context

kubectl config use-context $(kubectl config get-contexts -o name | fzf --height=10 --prompt="Kubernetes Context> ")

Choose a default namespace

kubectl config set-context --current --namespace "$(kubectl get ns -o name | fzf -d/ --with-nth=2 | cut -d/ -f2)"

Preview logs from any pod (assuming the pods have only one container)

kubectl get pods -o name | fzf --preview="kubectl logs {} | tail -20" --preview-window=up:99%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment