Kubernetes Context & Namespace Switcher For PowerShell, Works Like A Charm

Jung-Hyun Nam
Mar 9 · 2 min read
https://unsplash.com/photos/aYHzEnSEH-w

If you are stick with Kubernetes every day, you may know or consider shorthand expression of the kubectl.

I’m using the alias K, kubectx and kubens every day. But these scripts are not designed for PowerShell. So I tried to make the own version of each shorthand convention. Naturally, you can use below snippets to your other environments, including Windows.

Requirements

These modules require the PSFzf module and fzf binary for your operating system.

The “K” Alias

The “Select-KubeContext” (a.k.a. kubectx)

The “Select-KubeNamespace” (a.k.a. kubens)

Paste these codes to your $PROFILE script code and restart the shell. Then you will get a more comfortable PowerShell workspace for your daily DevOps works.

Beyond the Windows

DevOps Engineer’s Blog

Jung-Hyun Nam

Written by

DevOps Engineer @ DEVSISTERS, Corp., Microsoft MVP since 2009, Living in S.Korea.

Beyond the Windows

DevOps Engineer’s Blog

More From Medium

More on DevOps from Beyond the Windows

More on DevOps from Beyond the Windows

How To Protect Your WSL Distro More Firmly

More on DevOps from Beyond the Windows

More on DevOps from Beyond the Windows

More on DevOps from Beyond the Windows

Choosing Your Base Image in Windows Container

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade