LinuxCommandLibrary

kube-fzf

Quickly find and select Kubernetes resources

TLDR

Get pod details (from current namespace)

$ findpod
copy

Get pod details (from all namespaces)
$ findpod -a
copy

Describe a pod
$ describepod
copy

Tail pod logs
$ tailpod
copy

Exec into a pod's container
$ execpod [shell_command]
copy

Port-forward a pod
$ pfpod [port_number]
copy

SYNOPSIS

kubectl get | fzf | kubectl -f -

PARAMETERS

kubectl get
    Specifies the type of Kubernetes resource to list (e.g., pods, deployments, services).

fzf
    Invokes the fzf fuzzy finder, allowing interactive selection from the list of resources.

kubectl -f -
    Executes a `kubectl` command (e.g., describe, logs, exec) on the selected resource. '-f -' reads the selected resource name from standard input (piped from fzf).

DESCRIPTION

kube-fzf is a command-line tool that leverages the power of fzf (a general-purpose command-line fuzzy finder) to enable efficient and intuitive selection of Kubernetes resources. It allows users to interactively choose from various Kubernetes objects such as pods, deployments, services, and more. By piping the output of `kubectl get` commands through fzf, kube-fzf provides a visually appealing and fast way to filter and select the desired resource. This significantly simplifies tasks like connecting to a pod shell, viewing logs, or describing a resource, as it eliminates the need to remember exact names or manually type long commands. Users can use fuzzy search to quickly narrow down the list of available resources, making Kubernetes management much faster and more user-friendly.

kube-fzf is typically implemented as a shell script or a standalone executable that integrates with `kubectl` and `fzf`. It streamlines workflows by reducing the amount of typing needed to interact with Kubernetes resources and makes the command-line experience more efficient.

CAVEATS

Requires both `kubectl` and `fzf` to be installed and configured properly in your environment.

WORKFLOW EXAMPLES

Connecting to a Pod Shell:
`kubectl get pods | fzf | kubectl exec -it - bash`

Viewing Pod Logs:
`kubectl get pods | fzf | kubectl logs -f`

Describing a Deployment:
`kubectl get deployments | fzf | kubectl describe -f -`

SEE ALSO

kubectl(1), fzf(1)

Copied to clipboard