Command

Kubernetes Set Namespace for Current Context Command

The Kubernetes command to set namespace for current context is kubectl config set-context --current --namespace=<namespace>.

Quick Answer

Command
kubectl config set-context --current --namespace=<namespace>
KubernetesCommand

Set Namespace for Current Context

Type this command
kubectl config set-context --current --namespace=<namespace>

Permanently saves the namespace for all subsequent kubectl commands in that context.

Learn More

How to set namespace for current context in Kubernetes

  1. Open the terminal or command interface for Kubernetes.
  2. Type kubectl config set-context --current --namespace=<namespace>, replace any placeholders, and run it.

Kubernetes Set Namespace for Current Context Command

Run kubectl config set-context --current --namespace=<namespace>.

Related Commands

Frequently asked questions

What is the Kubernetes command to set namespace for current context?

Run kubectl config set-context --current --namespace=<namespace>.

Where do I type this Kubernetes command?

Type it in the terminal or command-line interface used by Kubernetes.

Does this Kubernetes command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify