Skip to content

Iron-E/kzf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kzf

kzf is an fzf-powered Kubernetes TUI.

Preview cap

TODO: add gif

Motivation

kubectl is a very useful tool.

While iterating on new services in Kubernetes, though, its verbosity adds a noticeable "navigation" cost to inspecting the state of the cluster. This is especially apparent when drilling into problems that a service may be experiencing.

Shell aliases help (I have many), but do little when inspecting resources that have dynamic names (e.g. Pods attached to ReplicaSets).

A shell's autocomplete could then, in theory, further reduce the navigation cost. However, a slow connection to the cluster will end up adding more to the navigation cost than it saves.

[k9s] is a good solution to this problem, however, its issues with MFA prevent those in many corporate environments from using it.

After seeing what fzf could do via fzf-lua, the idea for a new Kubernetes TUI, powered by fzf arose.

Goals

kzf is not a replacement or substitute for kubectl.

This project aims to optimize the processes of:

  • inspecting the current state of resources in a cluster.
  • comparing the state of resources across --contexts and --namespaces.

This project does not aim to be a substitute/replacement for:

  • kubectl

    Not all features of kubectl will be implemented.

    kubectl features unrelated to resource inspection/debugging (or those which are difficult/unfit to implement with fzf) are unlikely to be implemented.

    The following is an inexhaustive list of unsupported features:

    • Non-resource inspection: annotate, apply, auth, diff, explain, kustomize, label, replace, scale, taint
    • Difficult interface (PR welcome): debug, port-forward
  • An observability stack.

    kzf provides no special mechanism to show how the history of a cluster contributed to its current state.

Features

  • Attaching to containers
  • Colors (via kubecolor)
  • Deleting resources (w/ confirmation)
  • Describing resources
  • Executing commands in containers
  • Fuzzy selection (via fzf)
  • Restarting rollouts
  • Showing resource YAML
  • Switching contexts & namespaces
  • Viewing logs
  • Watching resources (live views)

Installation

Manual

Requirements:

Clone this repository and copy src/kzf.sh to any location in your $PATH.

Nix Flake

Tip

You can try kzf without changing any Nix configuration:

# run kzf
nix run github:Iron-E/kzf

# enter a temporary shell with kzf installed
nix shell github:Iron-E/kzf

Requirements:

  • A $PAGER

Add kzf to your flake inputs:

{
  # ...
  inputs = {
    # ...

    kzf.url = "github:Iron-E/kzf";

    # ...
  };

  outputs = inputs@{ ... }: {
    # ...
  };
}

Then, you can reference kzf in outputs as inputs.kzf.packages.<SYSTEM>.default (e.g. inputs.kzf.packages."x86_64-linux".default.

Usage

Note

kzf can integrate with the following tools:

See kzf -h for help information, and press F1 while inside kzf to see a list of keyboard shortcuts.

Configuration

There is no built-in configuration mechanism for kzf. Instead, one may use e.g. aliases.

Contributing

The nix flake contains a developer environment. This environment configures pre-commit hooks and vendors dev dependencies.

Please try to use it when contributing to the project.

Similar Projects