Can I set a default namespace in Kubernetes?

前端 未结 2 1798
耶瑟儿~
耶瑟儿~ 2020-12-29 22:34

Can I set the default namespace? That is:

$ kubectl get pods -n NAMESPACE

It saves me having to type it in each time especially when I\'m o

2条回答
  •  醉酒成梦
    2020-12-29 22:59

    Yes, you can set the namespace as per the docs like so:

    $ kubectl config set-context --current --namespace=NAMESPACE
    

    Alternatively, you can use kubectx for this.

提交回复
热议问题