Home > Mobile >  K8S\Kubectl: How can I change Kubernetes context namespace name?
K8S\Kubectl: How can I change Kubernetes context namespace name?

Time:12-27

Using

kubectl config get-contexts

I received a list of my account contexts in the format of :

CURRENT NAME CLUSTER AUTHINFO NAMESPACE

For one of them, I'd like to change its ns name.

How can I do that?

CodePudding user response:

You can use : kubectl config set-context –current –namespace=you-NS

Or install an easy tool for managing contexts and namespaces kubectx/kubens

kubens # list all ns

kubens your-NS # change ns

https://github.com/ahmetb/kubectx

CodePudding user response:

You can use kubectl config set-context to change configurations of context

Ex: kubectl config set-context <context-name> --namespace=<namespace-name>

For more information refer to this link

  • Related