Are you tired of typing the namespace in every kubectl command? Do you keep forgetting the command for switching the kubectl context? Speed up your kubectl process with these kubectl tools! I am refering to the tools that come with kubectx.

Installation

On macOS I used brew to do the installation. The code for kubectx can be found on github here and the documentation is perfect. Please check it out for installation on another OS.

brew install kubectx

The installation unlocks a command for navigating between contexts (kubectx) and a command for navigation around namespaces (kubens).

Context

The command for switching context is not always on the top of my mind. Now I just use this intuitive command to list all my contexts (and the current):

kubectx list namespaces 1024x117 - KUBECTL TOOLS

To switch do this

kubectx normal output 1024x64 - KUBECTL TOOLS

And you can even go to the previous context

kubectx output 1024x64 - KUBECTL TOOLS

This way navigating between contexts becomes fast and easy.

Namespace

We can navigate between namespaces in pretty much the same way. We only use the command kubens instead. Here is a summary of the possibilities.

kubens help output 1024x218 - KUBECTL TOOLS

When switched to a specific namespace, you can omit the namespace from your kubectl command! All commands become shorter and they stay the same for all namespaces. This way the commands become much easier to reuse.

Hopefully you will install these awesome kubectl tools and speed up your kubectl process. Happy kubectling!