From 7357a8fe76948ff1ed279c2aa13dbfc48e4e89cd Mon Sep 17 00:00:00 2001 From: fleaz Date: Sat, 31 May 2025 22:07:02 +0200 Subject: [PATCH] Fill README with content --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 30de236..94d825f 100644 --- a/README.md +++ b/README.md @@ -1 +1,46 @@ # ktx + +> Plant a Tree, Have a Baby, Build a k8s context switcher + + +## Motivation +Like every good YAML Engineer, I'm constantly switching between half a dozen k8s clusters with a big list of namespaces in each of them. This gets cumbersume with just plain kubectl, so a big ecosystem of context switchers has evolved. I tried some of them, but I had at least one problem with each of them, so I started my own to fullfill my needs. My personal requirements for a context switcher are: + * When opening a new shell I want to be in the context I used last + * When switching context or namespace in one shell, all other shells should not be affected + +## Installation + +Requirements: + * kubectl, fzf and jq are installed + * Your global k8s config is in ~/.kube/config + +Setup: + +```shell +# Clone the repo somewhere +cd ~/repos && git clone https://git.rainbownerds.de/fleaz/ktx + +# Source the ktx script in your shell config +echo "source ~/repos/ktx/ktx" >> .zshrc + +# Create the required directory +mkdir ~/.kube/ktx +``` + +Now open a new shell and you should have `ktx` and `kn` available + +## Usage + +```shell +# ktx alone to get a list of all your contexts to choose from +ktx +# ktx with the name of a context to directly switch to it +ktx prod-ams1 +# ktx with the name of a context and a namespace +ktx prod-ams1 monitoring + +# kn alone to get a list of all namespaces in the current cluster +kn +# kn with the name of a namespace to directly switch to it +``` +