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.
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).
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):
To switch do this
And you can even go to the previous context
This way navigating between contexts becomes fast and easy.
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.
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!