kzf is an fzf-powered Kubernetes TUI.
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:
-
kubectlNot all features of
kubectlwill be implemented.kubectlfeatures unrelated to resource inspection/debugging (or those which are difficult/unfit to implement withfzf) 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
- Non-resource inspection:
-
An observability stack.
kzfprovides no special mechanism to show how the history of a cluster contributed to its current state.
- 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)
Requirements:
Clone this repository and copy src/kzf.sh to any location in your $PATH.
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/kzfRequirements:
- 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.
See kzf -h for help information, and press F1 while inside kzf to see a list of keyboard shortcuts.
There is no built-in configuration mechanism for kzf. Instead, one may use e.g. aliases.
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.
