Kubectl Quality of Life tools
Kubectl Quality of Life tools The idea of this blogpost is to showcase some of the tools that i gathered in the past years to have a better quality of life when using Kubectl command line :) Repo to install vía script: https://github.com/md

The idea of this blogpost is to showcase some of the tools that i gathered in the past years to have a better quality of life when using Kubectl command line :)
Repo to install vía script: https://github.com/mdiloreto/kubectl-qol-tools

Tools covered below
- Alias
k=kubectl→ shortcut for fewer keystrokes. - kubectx → switch between Kubernetes contexts easily.
- kubens → switch between Kubernetes namespaces quickly.
- Kubecolor → add colors to kubectl output for better readability.
- kubectl-ai → natural-language interface for kubectl using LLMs (Gemini, OpenAI, etc.).
- Krew → plugin manager for kubectl to install and manage extensions.
Alias k=kubectl
At some point i’ve got ired of typing kubectl over and over again… setting up a short alias like k can save you a lot of keystrokes. The trick is to make the alias persistent, so it loads automatically every time you open your terminal. You can review also thekubectl-aliases project to add more kubernetes aliases… Personally i just prefer only to use k!
Windows (PowerShell)
In PowerShell, aliases last only for the current session unless you add them to your PowerShell profile:
- Check if your profile exists
Test-Path $PROFILE
2. If it returns False, create it:
New-Item -Path $PROFILE -ItemType File -Force
3. Edit your profile
notepad $PROFILE4. Add the alias
Set-Alias -Name k -Value kubectl
Or simply run:
Add-Content -Path $PROFILE -Value 'Set-Alias -Name k -Value kubectl'5. Reload your profile without restarting PowerShell:
. $PROFILE
Now k will always be available when you start PowerShell.
Linux / macOS (Bash or Zsh)
For Bash, Zsh, or similar shells, aliases live in your shell configuration file.
- Open your shell config file
For Bash:
nano ~/.bashrc- 2. For Zsh (macOS default & many Linux users):
nano ~/.zshrc- 3. Add the alias
alias k=kubectl
4. Reload your shell to apply changes:
source ~/.bashrc # For Bash source ~/.zshrc # For ZshFrom now on, typing k get pods will work exactly like kubectl get pods, no matter what shell session you start.

Kubectx
Kubectx is a cli tool that simplifies a lot how to switch between Kubernetes contexts.

What is the Kubectl context?
Basically the Kubernetes contexts in kubectl are essentially connection profiles that tell kubectl which cluster to talk to, as which user, and in which namespace by default.
They are part of your kubeconfig file (usually at ~/.kube/config), and each context specifies three key things:
Which Kubernetes API server to connect to.
cluster: server: https://example-cluster:6443 certificate-authority: /path/to/ca.crtname: the-cluster-nameThe user or credentials,
user: client-certificate: /path/to/cert.crt client-key: /path/to/key.keyor the namespace:
namespace: devInstall on Windows
You can simply install using this command:
winget install --id ahmetb.kubectx
Open a new PowerShell terminal tab and you’ll be able to start using it.
Homebrew (macOS and Linux)
If you use Homebrew you can install like this:
brew install kubectxThis command will set up bash/zsh/fish completion scripts automatically. Make sure you configure your shell to load completions for installed Homebrew formulas.
MacPorts (macOS)
If you use MacPorts you can install like this:
sudo port install kubectxapt (Debian)
sudo apt install kubectx
pacman (Arch Linux)
Available as official Arch Linux package. Install it via:
sudo pacman -S kubectxKubens
Kubens as the same concept and author from kubectx but for switching between namespaces.
Windows
To install on windows run:
curl.exe https://webi.ms/kubens | powershellLinux / MacOS
To install on Debian:
curl -sS https://webi.sh/kubens | sh; \source ~/.config/envman/PATH.env
If you liked kubectx / kubens, you could pair with fzf and kube-ps1. Also created by the same author ahmetb.
Kubecolor
Kubecolor is another really good project! As its name indicates, it allows you to make the Kubectl output colorfull. This can be sometimes really usefull to see errors in large outputs.
Windows
To install on windows:
winget install --id Kubecolor.kubecolorAfter install we need to add the aliases, so from now on kubectl is a proxy that shows the color and executes kubectl in the backend:
Add-Content -Path $PROFILE -Value 'Set-Alias -Name kubectl -Value kubecolor'

Brew (MacOs)
To install on Mac:
brew install kubecolorLinux (debian)
To install on Debian, Ubuntu, Pop!_OS, Linux Mint, Elementary OS:
sudo apt-get updatesudo apt-get install -y wget
ver=$(wget -qO- https://kubecolor.github.io/packages/deb/version)arch=$(dpkg --print-architecture)
wget -O /tmp/kubecolor.deb "https://kubecolor.github.io/packages/deb/pool/main/k/kubecolor/kubecolor_${ver}_${arch}.deb"sudo dpkg -i /tmp/kubecolor.debsudo apt-get -f install -y # if dpkg reports missing depsThen add this to the .zshrc file:
# Kubectl + Kubecolor completions (quiet, cached)alias k=kubectlalias kubectl=kubecolorcompdef kubecolor=kubectl
autoload -Uz compinitcompinit
if command -v kubectl >/dev/null; then # Cache location for kubectl completions KUBE_COMP="${XDG_CACHE_HOME:-$HOME/.cache}/kubectl_completion.zsh" mkdir -p "${KUBE_COMP:h}"
# Generate completions if missing or kubectl binary changed if [[ ! -f $KUBE_COMP || $(command -v kubectl) -nt $KUBE_COMP ]]; then kubectl completion zsh >| "$KUBE_COMP" fi
# Load completions source "$KUBE_COMP"fi
You can change the themes by runing:
export KUBECOLOR_PRESET="<theme-name>"And you can see the colorfull outputs:


For other distros, more info here: https://kubecolor.github.io/setup/install/
kubectl-ai
kubectl‑ai is an open-source command-line plugin developed by the GoogleCloudPlatform team. It brings a natural-language interface to Kubernetes by translating plain English prompts into kubectl commands, YAML manifests, or debugging assistance right in your terminal.
It supports multiple LLM endpoints: Gemini (default), OpenAI, xAI’s Grok, Azure OpenAI, AWS Bedrock, and even local models via Ollama or llama.cpp. It can also act as an MCP (Model Context Protocol) client/server and includes features like context awareness, tool extensions, and session persistence github.com.
The project is maintained and authored by the GoogleCloudPlatform organization on GitHub. While there isn’t a single named author, contributors include members of the Google Cloud (GKE) team. One contributor — a GKE engineer known as droot@github, previously prominent on the kubebuilder project — highlighted the tool on Reddit and described its capabilities and design goals
To install you need to run this command:
Linux
curl -sSL https://raw.githubusercontent.com/GoogleCloudPlatform/kubectl-ai/main/install.sh | bash
Windows (and others using krew)
kubectl krew install aiAfter you install it you need to setup your API Key 🔑. In my case, im using Gemini.
This is how it works! You ask and the tool does it for you!

- Here i deployed the ´nginx-deployment´ deploy with 3 replicas!
Take into account that this tool is still in development and you’ll need to have API Key’s with no much restrictions.
Krew
If you like kubectl-ai and want to explore even more extensions for kubectl, you’ll probably want to install Krew.
Krew is a plugin manager for kubectl that lets you discover, install, and manage hundreds of community plugins right from your terminal.
Think of it as Homebrew, but for kubectl plugins.
Once Krew is installed, you can run:
kubectl krew searchto browse available plugins, and:
kubectl krew install <plugin-name>to install one. Plugins are then available directly as:
kubectl <plugin-name>without any extra setup.
Installing Krew
Krew works on Linux, macOS, and Windows (via WSL or native PowerShell).
Here’s the official install method for Linux/macOS:
( set -x; cd "$(mktemp -d)" && OS="$(uname | tr '[:upper:]' '[:lower:]')" && ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/arm.*$/arm/')" && KREW="krew-${OS}_${ARCH}" && curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && tar zxvf "${KREW}.tar.gz" && "./${KREW}" install krew)After installation, add Krew to your PATH:
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"Thanks for reading. The learning continues in the next article.


