Kube context for everyone - Revisited!

August 5, 2022

Session based kube-context

In Kube context for everyone!, we wrote a bash script that helped us make session based changes to what context we were in. That script came with some drawbacks and potential Improvements. drawbacks

Those and other drawbacks I found on the way were addressed in a BLAZINGLING FAST! cli tool I created called kubesess, written in Rust with no dependencies needed (not counting kubectl, but you would need this tool if you didn't have that 😆).

It handles both namespace and context changes and even comes with its own fuzzy select (similar to fzf but BLAZINGLING FAST!).

Comparing the implementation

The only real other plugins that do the same thing are kubectx and kubens. And those tool uses kubectl commands to simplify those commands, which is fine but kubectl only supports global changes. kubesess solves it by utilizing kubectls merge config capabilities with environment variables. This approach comes with the huge benefit that I can bypass kubectl completely without touching kubectl global config!

The limitation to this way is that I need to wrap the app in a shell script that prepends the $KUBECONFIG environment variable with the output of the program, kubectl handles the rest!

Comparing performance

It wouldn't be a Rust app if we didn't have BLAZINGLING FAST performance so here are some benchmarks: BLAZINGLING FAST!