kube-fzf
Quickly find and select Kubernetes resources
TLDR
Get pod details (from current namespace)
Get pod details (from all namespaces)
Describe a pod
Tail pod logs
Exec into a pod's container
Port-forward a pod
SYNOPSIS
source ~/.kube/kube-fzf.sh
Examples:
k get po
kd deploy/nginx
klf nginx-abc-123
k ctx
PARAMETERS
KUBE_FZF_NS_SWITCHER
Enable namespace switcher menu (default: true)
KUBE_FZF_CONTEXT_SWITCHER
Context switcher command (e.g., k9s, kubie)
KUBE_FZF_DEFAULT_NS
Default namespace if none selected
KUBE_FZF_POD_LOGS_OPTS
Extra flags for kubectl logs (e.g., --previous)
KUBE_FZF_ENABLE_AUTO_HIGHLIGHT
Syntax highlighting in fzf previews (default: true)
KUBE_FZF_PREVIEW_MAX_WIDTH
Max width for preview pane (default: 120)
DESCRIPTION
kube-fzf enhances kubectl with fzf for interactive fuzzy searching of clusters, contexts, namespaces, pods, deployments, services, and more. Source the script once in your shell to unlock tab-completion and menus that preview resource details, status, logs previews, and YAML snippets.
Streamline workflows: switch contexts/namespaces effortlessly, select resources by fuzzy match instead of IDs, and chain operations like get → describe → logs → exec. Aliases like k, kg, kd, kl simplify typing. Customizable via environment variables for logs options, highlighting, and preview sizes.
Boosts productivity in multi-cluster environments, reducing errors from typos or scrolling long lists. Integrates with tools like bat for syntax-highlighted previews. Open-source, lightweight, no daemon required.
CAVEATS
Requires fzf >= 0.24, kubectl. Bash/zsh only. Large clusters may slow previews. Needs bat/highlight/jq for best previews.
INSTALLATION
mkdir -p ~/.kube && curl -sL https://raw.githubusercontent.com/miku/kube-fzf/master/kube-fzf.sh | sed "1,/^# Last step/d" > ~/.kube/kube-fzf.sh && [[ -f ~/.kube/kube-fzf.sh ]] && source ~/.kube/kube-fzf.sh
KEY ALIASES
k=kubectl, kg=get, kd=describe, kl=logs, kld=logs -f --previous, kexec=exec -it, kpf=port-forward
SUPPORTED RESOURCES
pods(po), deployments(deploy), services(svc), configmaps(cm), secrets, ingresses(ing), nodes, pv/pvc, jobs/cronjobs, hpa, networkpolicies
HISTORY
Developed by Patrick Michalina (@miku) starting 2018 on GitHub. Grew from fzf+bash hacks for personal kubectl use. Now >3k stars, supports modern k8s, plugins like kubectx integration.


