Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dinhducit/b384f8963b33f8c89639b14b15d72bf5 to your computer and use it in GitHub Desktop.
Save dinhducit/b384f8963b33f8c89639b14b15d72bf5 to your computer and use it in GitHub Desktop.

Revisions

  1. @PashCracken PashCracken revised this gist Aug 21, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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
    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.2.4-linux-amd64.tar.gz
    rm helm-v3.3.0-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  2. @PashCracken PashCracken revised this gist Jun 24, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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
    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.1-linux-amd64.tar.gz
    rm helm-v3.2.4-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  3. @PashCracken PashCracken revised this gist Jun 24, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL-zsh-and-Powerlevel10k.md
    Original 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
    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
    ```
  4. @PashCracken PashCracken revised this gist May 29, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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.2-linux-amd64.tar.gz
    tar xvzf helm-v3.1.2-linux-amd64.tar.gz
    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.1.2-linux-amd64.tar.gz
    rm helm-v3.2.1-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  5. @PashCracken PashCracken revised this gist Apr 7, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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
    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.0-linux-amd64.tar.gz
    tar xvzf helm-v3.1.0-linux-amd64.tar.gz
    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.0-linux-amd64.tar.gz
    rm helm-v3.1.2-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  6. @PashCracken PashCracken revised this gist Feb 16, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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
    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.0.3-linux-amd64.tar.gz
    rm helm-v3.1.0-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  7. @PashCracken PashCracken revised this gist Feb 4, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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
    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.2-linux-amd64.tar.gz
    rm helm-v3.0.3-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  8. @PashCracken PashCracken revised this gist Jan 21, 2020. No changes.
  9. @PashCracken PashCracken revised this gist Jan 21, 2020. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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
    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.1-linux-amd64.tar.gz
    tar xvzf helm-v3.0.1-linux-amd64.tar.gz
    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.1-linux-amd64.tar.gz
    rm helm-v3.0.2-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  10. @PashCracken PashCracken revised this gist Jan 4, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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.1-linux-amd64.tar.gz
    tar xvzf helm-v3.0.1-linux-amd64.tar.gz
    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.1-linux-amd64.tar.gz
    rm helm-v3.0.2-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  11. @PashCracken PashCracken revised this gist Jan 3, 2020. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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://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
    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-v2.16.0-linux-amd64.tar.gz
    rm helm-v3.0.1-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  12. @PashCracken PashCracken revised this gist Nov 12, 2019. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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.14.2/bin/linux/amd64/kubectl
    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.14.0-linux-amd64.tar.gz
    tar xvzf helm-v2.14.0-linux-amd64.tar.gz
    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.14.0-linux-amd64.tar.gz
    rm helm-v2.16.0-linux-amd64.tar.gz
    rm -r linux-amd64
    ```

  13. @PashCracken PashCracken revised this gist Nov 8, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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 "if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi" >> ~/.zshrc
    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 "if [ $commands[helm] ]; then source <(helm completion zsh); fi" >> ~/.zshrc
    echo "source <(helm completion zsh)" >> ~/.zshrc
    ```

    Restart your WSL command prompt and you will have helm command with completion
  14. @PashCracken PashCracken revised this gist May 31, 2019. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions WSL-zsh-and-Powerlevel10k.md
    Original 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"
    ```

    Add completion
    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
    ```

    Add completion
    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
    ```

    Add completion
    Run commands to add completion

    ```zsh
    mkdir -p ~/.oh-my-zsh/completions
  15. @PashCracken PashCracken revised this gist May 31, 2019. No changes.
  16. @SaaSOps SaaSOps renamed this gist May 31, 2019. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions WSL-zsh-and-Powerlevel9k.md → WSL-zsh-and-Powerlevel10k.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    # WSL, zsh and Powerlevel9k
    # 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*

    ![WSL](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/6295adfe4fd0e2712b40f3a062ec7a2902c32657/WSL-with-zsh-and-powerlevel9k.png)

    ## 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 Powerlevel9k theme
    ### Install Powerlevel10k theme

    ```zsh
    git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
    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="powerlevel9k/powerlevel9k"
    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>
  17. @SaaSOps SaaSOps revised this gist May 31, 2019. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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 kns and kctx aliases to your ~/.zshrc file

    ```zsh
    alias kns=kubens
    alias kctx=kubectx
    ```

    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
    ```

  18. @SaaSOps SaaSOps revised this gist May 31, 2019. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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
    ```

    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
  19. @SaaSOps SaaSOps revised this gist May 31, 2019. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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
  20. @SaaSOps SaaSOps revised this gist May 31, 2019. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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.zsh
    ln -s /opt/kubectx/completion/kubens.zsh ~/.oh-my-zsh/completions/_kubens.zsh
    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.

    I was not able to get the completion working for kubens and kubectx. Not sure what is wrong.
    Restart your WSL command prompt and you will have kubens and kubectx available with completion.

    ## Useful links

  21. @SaaSOps SaaSOps revised this gist May 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL-zsh-and-Powerlevel9k.md
    Original 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 semicolon delimited list of Kubernetes config files to KUBECONFIG env variable in .zshrc file
    Add your colon delimited list of Kubernetes config files to KUBECONFIG env variable in .zshrc file

    ```zsh
    nano ~/.zshrc
  22. Jan Lønsetteig revised this gist May 31, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL-zsh-and-Powerlevel9k.md
    Original 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 the compleation working for kubens and kubectx. Not sure what is wrong.
    I was not able to get the completion working for kubens and kubectx. Not sure what is wrong.

    ## Useful links

  23. Jan Lønsetteig revised this gist May 31, 2019. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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>
    * <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>
  24. Jan Lønsetteig revised this gist May 31, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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.

    ![WSL](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/0a50f679e194129284d385008c659a4703c83201/WSL-with-zsh-and-powerlevel9k.png)
    ![WSL](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/6295adfe4fd0e2712b40f3a062ec7a2902c32657/WSL-with-zsh-and-powerlevel9k.png)

    ## 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`
    ![DejaVuSansMonoPowerline NF](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/0a50f679e194129284d385008c659a4703c83201/X-WSL-font-options.png)
    ![DejaVuSansMonoPowerline NF](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/6295adfe4fd0e2712b40f3a062ec7a2902c32657/X-WSL-font-options.png)

    ## Install and configure zsh

  25. Jan Lønsetteig revised this gist May 31, 2019. 3 changed files with 2 additions and 2 deletions.
    Binary file added WSL-with-zsh-and-powerlevel9k.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
    4 changes: 2 additions & 2 deletions WSL-zsh-and-Powerlevel9k.md
    Original 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.

    ![WSL](https://gist.github.com/PashCracken/1f08524b185fc320bb582f740d09a2bb/raw/0a50f679e194129284d385008c659a4703c83201/WSL-with-zsh-and-powerlevel9k.png)
    ![WSL](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/0a50f679e194129284d385008c659a4703c83201/WSL-with-zsh-and-powerlevel9k.png)

    ## 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`
    ![DejaVuSansMonoPowerline NF](https://gist.github.com/PashCracken/1f08524b185fc320bb582f740d09a2bb/raw/0a50f679e194129284d385008c659a4703c83201/WSL-font-options.png)
    ![DejaVuSansMonoPowerline NF](https://gist.github.com/PashCracken/b6070359486ea651eed66a5e86567ebb/raw/0a50f679e194129284d385008c659a4703c83201/X-WSL-font-options.png)

    ## Install and configure zsh

    Binary file added X-WSL-font-options.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  26. @PashCracken PashCracken revised this gist May 31, 2019. No changes.
  27. @PashCracken PashCracken renamed this gist May 31, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  28. @PashCracken PashCracken created this gist May 31, 2019.
    159 changes: 159 additions & 0 deletions readme.md
    Original 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.

    ![WSL](https://gist.github.com/PashCracken/1f08524b185fc320bb582f740d09a2bb/raw/0a50f679e194129284d385008c659a4703c83201/WSL-with-zsh-and-powerlevel9k.png)

    ## 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`
    ![DejaVuSansMonoPowerline NF](https://gist.github.com/PashCracken/1f08524b185fc320bb582f740d09a2bb/raw/0a50f679e194129284d385008c659a4703c83201/WSL-font-options.png)

    ## 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>