Disable Kubecontext (namespace) display on Powerlevel ZSH Theme
Tags: kubernetes, bash, productivity
Published: 2019-11-25 18:49:26

# Just give me the solution right away!!!

In order to disable Kubecontext (namespace) display on [Powerlevel ZSH Theme](https://github.com/romkatv/powerlevel10k), just comment out or remove the `kubecontext` declaration around line **67** in your current `/Users/$yourusername/.p10k.zsh` script. Example:

  ```
  typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  ...
  # kubecontext # current kubernetes context (https://kubernetes.io/)
  ...
  )
  ```

Restart your terminal and notice the missing **kubernetes Kubecontext (namespace)** info on your terminal session.

# Introduction

I've a regular [Oh My ZSH](https://ohmyz.sh/) user for a few weeks and often times, I try to test new plugins or themes and today (Nov 25) i've came across the [Powerlevel ZSH Theme](https://github.com/romkatv/powerlevel10k).

I found it so cool that I decided to give it a try, but after finishing the [installation process](https://github.com/romkatv/powerlevel10k#installation), the terminal was displaying the **Kubernetes Kubecontext (namespace)** info, which I strongly want to remove it.

![Powerlevel ZSH Theme Kubernetes Kubecontext]
(https://thepracticaldev.s3.amazonaws.com/i/5ql6yefo1ltf7k713phw.png)

# The Problem

After going thru the installation one more time (the whole process is managed by a *Next, Next, Finish Terminal like experience*), I've noticed that **Kubernetes namespace** was displayed. Thus, i've decided to double check if there's any **Kubernetes** related configuration section which I've missed, however, unfortunately the installer offers no feature to change this behaviour.

After *googleing* a little bit about this issue, I've found some open issues ([860](https://github.com/Powerlevel9k/powerlevel9k/issues/860) , [1252](https://github.com/Powerlevel9k/powerlevel9k/issues/1252)) on [github](https://github.com/Powerlevel9k/powerlevel9k/issues) to address this problem, however no solution was pointed out.

With that said, i thought it was something related to others *Oh My ZSH* [plugins](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins) such as [kube-ps1](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/kube-ps1) or some miss configuration on my side, which was not the case.

Since I couldn't find anything that could shade some light on this issue,  reviewing *ZSH configuration* `/Users/$yourusername/.zshrc` was my next choice and luckily I've found this:

  ```
  # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
  [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
  ```

# Fixing the Problem

The **p10k.zsh** script performs all *heavy-lifting* for [Powerlevel ZSH Theme](https://github.com/romkatv/powerlevel10k), therefore, all configurations, extensions and customisations should be available within it.

Thus, I've spent some minuted reviewing it's source code and came across this snippet:

  ```
  typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
  ...
  kubecontext # current kubernetes context (https://kubernetes.io/)
  ...
  )
  ```

After commenting out kubecontext declaration from the above snippet, finally the **kubernetes Kubecontext (namespace)** no longer came out.

![Powerlevel ZSH Theme Kubernetes Without Kubecontext](https://thepracticaldev.s3.amazonaws.com/i/pirccdz1nw6stg0ml0ih.png)