Have you ever wondered how to go from this:
to this:
so you can do this:
Checkout following 8 steps.
Prerequisities:
- kubectl installed
- Windows 10 version 22000.0 or higher
- windows terminal and Ubuntu (I use 20.04) installed from MS store
- apt-get update
1. Install Zsh
sudo apt install zsh -y
2. Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
3. Install kubectx and kubens
kubectx and kubens are tools that allow you to quickly switch between k8s context (kubectx) and namespaces (kubens). They however do not give you this cool up-down arrow search you saw on the clip. This is done with Fzf (see step 6).
sudo git clone https://github.com/ahmetb/kubectx /opt/kubectx sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens
4. Install kube-ps1
kube-ps1 shows current context and namespace in terminal prompt, no more wondering whether you’re on right cluster or namespace ! 🦾
sudo git clone https://github.com/jonmosco/kube-ps1.git
5. Install zsh-autosuggestions
Cool plugin which suggest you commands as you type them.
sudo git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
6. Install Fzf
Tool for filtering command-line, allows to jump through kubectx and kubens results. Checkout that tool as it has much more features.
sudo apt-get install fzf
7. Modify .zshrc file
Open your .zshrc file vim ~/.zshrc
and paste following lines there:
you can also find ‘plugins’ section, source $ZSH/oh-my-zsh.sh
should already be there either.
plugins=(git kubectl kube-ps1 kubectx zsh-autosuggestions) source $ZSH/oh-my-zsh.sh source ~/kube-ps1/kube-ps1.sh PROMPT='$(kube_ps1)'$PROMPT KUBE_PS1_SYMBOL_USE_IMG=false KUBE_PS1_SYMBOL_ENABLE=false KUBE_PS1_PREFIX= KUBE_PS1_SUFFIX=
if you’re happy with your changes quit vim :x
if you’re not:
8. The most important part 😉 change skin to darcula
Just follow the install part from their website
That was really valuable!