Forked from PashCracken/WSL-with-zsh-and-powerlevel9k.png
Created
September 8, 2020 02:49
-
-
Save dinhducit/b384f8963b33f8c89639b14b15d72bf5 to your computer and use it in GitHub Desktop.
Revisions
-
PashCracken revised this gist
Aug 21, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.3.0-linux-amd64.tar.gz tar xvzf helm-v3.3.0-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.3.0-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Jun 24, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.2.4-linux-amd64.tar.gz tar xvzf helm-v3.2.4-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.2.4-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Jun 24, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,7 +69,7 @@ Restart your WSL command prompt and it will look great ### kubectl ```zsh curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.4/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` -
PashCracken revised this gist
May 29, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.2.1-linux-amd64.tar.gz tar xvzf helm-v3.2.1-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.2.1-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Apr 7, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,7 +69,7 @@ Restart your WSL command prompt and it will look great ### kubectl ```zsh curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.1.2-linux-amd64.tar.gz tar xvzf helm-v3.1.2-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.1.2-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Feb 16, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz tar xvzf helm-v3.1.0-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.1.0-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Feb 4, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.0.3-linux-amd64.tar.gz tar xvzf helm-v3.0.3-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.0.3-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Jan 21, 2020 . No changes.There are no files selected for viewing
-
PashCracken revised this gist
Jan 21, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,7 +69,7 @@ Restart your WSL command prompt and it will look great ### kubectl ```zsh curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.4/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz tar xvzf helm-v3.0.2-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.0.2-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Jan 4, 2020 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,12 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz tar xvzf helm-v3.0.2-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.0.2-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Jan 3, 2020 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -110,13 +110,12 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://get.helm.sh/helm-v3.0.1-linux-amd64.tar.gz tar xvzf helm-v3.0.1-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/ #Cleanup rm helm-v3.0.1-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Nov 12, 2019 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -69,7 +69,7 @@ Restart your WSL command prompt and it will look great ### kubectl ```zsh curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.16.2/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` @@ -110,13 +110,13 @@ Restart your WSL command prompt and you will see the Kubernetes context and have ### helm ```zsh wget -q https://storage.googleapis.com/kubernetes-helm/helm-v2.16.0-linux-amd64.tar.gz tar xvzf helm-v2.16.0-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin helm init -c #Cleanup rm helm-v2.16.0-linux-amd64.tar.gz rm -r linux-amd64 ``` -
PashCracken revised this gist
Nov 8, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -89,7 +89,7 @@ export KUBECONFIG="/mnt/c/dev/kubernetes/rnd-admin.conf:/mnt/c/Users/janl/.kube/ Run command to add completion ```zsh echo "source <(kubectl completion zsh)" >> ~/.zshrc ``` Add shorthand alias for kubectl @@ -123,7 +123,7 @@ rm -r linux-amd64 Run command to add completion ```zsh echo "source <(helm completion zsh)" >> ~/.zshrc ``` Restart your WSL command prompt and you will have helm command with completion -
PashCracken revised this gist
May 31, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,7 +86,7 @@ Add the follwing at the end of the file and change paths to your config files. I export KUBECONFIG="/mnt/c/dev/kubernetes/rnd-admin.conf:/mnt/c/Users/janl/.kube/config" ``` Run command to add completion ```zsh echo "if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi" >> ~/.zshrc @@ -120,7 +120,7 @@ rm helm-v2.14.0-linux-amd64.tar.gz rm -r linux-amd64 ``` Run command to add completion ```zsh echo "if [ $commands[helm] ]; then source <(helm completion zsh); fi" >> ~/.zshrc @@ -138,7 +138,7 @@ sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens ``` Run commands to add completion ```zsh mkdir -p ~/.oh-my-zsh/completions -
PashCracken revised this gist
May 31, 2019 . No changes.There are no files selected for viewing
-
SaaSOps renamed this gist
May 31, 2019 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ # WSL, zsh and Powerlevel10k Beautiful command line interface for Windows 10 optimized for working with git and Kubernetes. *NB! This guide previously used Powerlevel9k. I changed it to Powerlevel10k to fix latency issues. Command prompt response is much faster now. Configuration settings is compatible with 9k. Only changes needed is to clone 10k repo and change ZSH_THEME*  ## Pre-reqs @@ -36,10 +38,10 @@ sudo apt install zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` ### Install Powerlevel10k theme ```zsh git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k ``` ### Configure oh-my-zsh @@ -51,7 +53,7 @@ nano ~/.zshrc Open .zsh in nano and change/add the following settings ```zsh ZSH_THEME="powerlevel10k/powerlevel10k" POWERLEVEL9K_MODE='nerdfont-complete' POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status kubecontext time) @@ -161,6 +163,7 @@ Restart your WSL command prompt and you will have kubens and kubectx available w * <https://github.com/ryanoasis/nerd-fonts> * <https://github.com/robbyrussell/oh-my-zsh> * <https://github.com/bhilburn/powerlevel9k> * <https://github.com/romkatv/powerlevel10k> * <https://kubernetes.io/docs/reference/kubectl/cheatsheet/> * <https://helm.sh/docs/using_helm/#installing-helm> * <https://github.com/ahmetb/kubectx> -
SaaSOps revised this gist
May 31, 2019 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -136,20 +136,21 @@ sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens ``` Add completion ```zsh mkdir -p ~/.oh-my-zsh/completions chmod -R 755 ~/.oh-my-zsh/completions ln -s /opt/kubectx/completion/kubectx.zsh ~/.oh-my-zsh/completions/_kubectx ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens ``` Add kns and kctx aliases at the end of your ~/.zshrc file Also add the `rm -f ~/.zcompdump; compinit` to fix an issue with completion for kubens and kubectx ```zsh alias kns=kubens alias kctx=kubectx rm -f ~/.zcompdump; compinit ``` -
SaaSOps revised this gist
May 31, 2019 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -136,6 +136,13 @@ sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens ``` Add kns and kctx aliases to your ~/.zshrc file ```zsh alias kns=kubens alias kctx=kubectx ``` Add completion ```zsh @@ -146,13 +153,6 @@ ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens rm -f ~/.zcompdump; compinit ``` Restart your WSL command prompt and you will have kubens and kubectx available with completion. ## Useful links -
SaaSOps revised this gist
May 31, 2019 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -146,6 +146,13 @@ ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens rm -f ~/.zcompdump; compinit ``` Add kns and kctx aliases to your ~/.zshrc file ```zsh alias kns=kubens alias kctx=kubectx ``` Restart your WSL command prompt and you will have kubens and kubectx available with completion. ## Useful links -
SaaSOps revised this gist
May 31, 2019 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -141,13 +141,12 @@ Add completion ```zsh mkdir -p ~/.oh-my-zsh/completions chmod -R 755 ~/.oh-my-zsh/completions ln -s /opt/kubectx/completion/kubectx.zsh ~/.oh-my-zsh/completions/_kubectx ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens rm -f ~/.zcompdump; compinit ``` Restart your WSL command prompt and you will have kubens and kubectx available with completion. ## Useful links -
SaaSOps revised this gist
May 31, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -72,7 +72,7 @@ chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` Add your colon delimited list of Kubernetes config files to KUBECONFIG env variable in .zshrc file ```zsh nano ~/.zshrc -
Jan Lønsetteig revised this gist
May 31, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -147,7 +147,7 @@ ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens.zsh Restart your WSL command prompt and you will have kubens and kubectx available. I was not able to get the completion working for kubens and kubectx. Not sure what is wrong. ## Useful links -
Jan Lønsetteig revised this gist
May 31, 2019 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -151,9 +151,9 @@ I was not able to the compleation working for kubens and kubectx. Not sure what ## Useful links * <https://github.com/ryanoasis/nerd-fonts> * <https://github.com/robbyrussell/oh-my-zsh> * <https://github.com/bhilburn/powerlevel9k> * <https://kubernetes.io/docs/reference/kubectl/cheatsheet/> * <https://helm.sh/docs/using_helm/#installing-helm> * <https://github.com/ahmetb/kubectx> -
Jan Lønsetteig revised this gist
May 31, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Beautiful command line interface for Windows 10 optimized for working with git and Kubernetes.  ## Pre-reqs @@ -20,7 +20,7 @@ Unzip file and install the `DejaVu Sans Mono for Powerline Nerd Font Complete Mo ## Change WSL font Open the WSL options and change font to `DejaVuSansMonoPowerline NF`  ## Install and configure zsh -
Jan Lønsetteig revised this gist
May 31, 2019 . 3 changed files with 2 additions and 2 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Beautiful command line interface for Windows 10 optimized for working with git and Kubernetes.  ## Pre-reqs @@ -20,7 +20,7 @@ Unzip file and install the `DejaVu Sans Mono for Powerline Nerd Font Complete Mo ## Change WSL font Open the WSL options and change font to `DejaVuSansMonoPowerline NF`  ## Install and configure zsh LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
PashCracken revised this gist
May 31, 2019 . No changes.There are no files selected for viewing
-
PashCracken renamed this gist
May 31, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
PashCracken created this gist
May 31, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,159 @@ # WSL, zsh and Powerlevel9k Beautiful command line interface for Windows 10 optimized for working with git and Kubernetes.  ## Pre-reqs * Windows 10 * Windows Subsystem for Linux. I use Ubuntu 18.04 ## Install required nerd-fonts Install Powerline, Windows compatible font from this repo <https://github.com/ryanoasis/nerd-fonts>. You need to install version 1.2.0 since version 2.0.0 don't work with Windows. Download this asset <https://github.com/ryanoasis/nerd-fonts/releases/download/v1.2.0/DejaVuSansMono.zip>. Unzip file and install the `DejaVu Sans Mono for Powerline Nerd Font Complete Mono Windows Compatible.ttf` font by right-clicking on the file and select install. ## Change WSL font Open the WSL options and change font to `DejaVuSansMonoPowerline NF`  ## Install and configure zsh ### Install zsh ```bash sudo apt install zsh ``` ### Install oh-my-zsh ```bash sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` ### Install Powerlevel9k theme ```zsh git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k ``` ### Configure oh-my-zsh ```zsh nano ~/.zshrc ``` Open .zsh in nano and change/add the following settings ```zsh ZSH_THEME="powerlevel9k/powerlevel9k" POWERLEVEL9K_MODE='nerdfont-complete' POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status kubecontext time) POWERLEVEL9K_PROMPT_ON_NEWLINE=true # If you have installed Windows 10 1903 then you can skip the next line POWERLEVEL9K_COLOR_SCHEME='light' ``` Restart your WSL command prompt and it will look great ## Kubernetes tools ### kubectl ```zsh curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.14.2/bin/linux/amd64/kubectl chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl ``` Add your semicolon delimited list of Kubernetes config files to KUBECONFIG env variable in .zshrc file ```zsh nano ~/.zshrc ``` Add the follwing at the end of the file and change paths to your config files. I choose to point them to my Windows k8s config files that I also use in Powershell ```zsh export KUBECONFIG="/mnt/c/dev/kubernetes/rnd-admin.conf:/mnt/c/Users/janl/.kube/config" ``` Add completion ```zsh echo "if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi" >> ~/.zshrc ``` Add shorthand alias for kubectl ```zsh nano ~/.zshrc ``` Add the following to the end of the .zshrc file ```zsh alias k=kubectl complete -F __start_kubectl k ``` Restart your WSL command prompt and you will see the Kubernetes context and have code completion for both kubectl and the alias k ### helm ```zsh wget -q https://storage.googleapis.com/kubernetes-helm/helm-v2.14.0-linux-amd64.tar.gz tar xvzf helm-v2.14.0-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin helm init -c #Cleanup rm helm-v2.14.0-linux-amd64.tar.gz rm -r linux-amd64 ``` Add completion ```zsh echo "if [ $commands[helm] ]; then source <(helm completion zsh); fi" >> ~/.zshrc ``` Restart your WSL command prompt and you will have helm command with completion ### kubens and kubectx Tools for fast switching between clusters and namespaces ```zsh 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 ``` Add completion ```zsh mkdir -p ~/.oh-my-zsh/completions chmod -R 755 ~/.oh-my-zsh/completions ln -s /opt/kubectx/completion/kubectx.zsh ~/.oh-my-zsh/completions/_kubectx.zsh ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens.zsh ``` Restart your WSL command prompt and you will have kubens and kubectx available. I was not able to the compleation working for kubens and kubectx. Not sure what is wrong. ## Useful links <https://github.com/ryanoasis/nerd-fonts> <https://github.com/robbyrussell/oh-my-zsh> <https://github.com/bhilburn/powerlevel9k> <https://kubernetes.io/docs/reference/kubectl/cheatsheet/> <https://helm.sh/docs/using_helm/#installing-helm> <https://github.com/ahmetb/kubectx>