Kubectl Change Namespace Jun 2026

If the output is empty, you are currently operating in the default namespace. For a more visual experience, many developers use shell prompts like Oh My Zsh or Powerlevel10k, which can display your active Kubernetes namespace directly in your terminal command line. Best Practices for Namespace Management

This will output a list of namespaces, including their names and statuses. kubectl change namespace

kchns my-namespace

To switch to the prod namespace, you can use: If the output is empty, you are currently

alias kchns='kubectl config set-context --current --namespace' If the output is empty