LoginSignup
7
1

More than 5 years have passed since last update.

kubectlで現在のnamespaceを確認する

Last updated at Posted at 2019-04-19

現在のnamespaceを確認するには、現在のcontextを確認すればよいです。
kubectl config get-contexts

現在のcontext、namespaceを確認する

CURRENT 欄が * となっているのが現在の context です。
NAMESPACE 欄が現在の値です。
NAMESPACE 欄が空欄は、未指定の状態です。この場合の挙動は未確認です。

$ kubectl config get-contexts
CURRENT   NAME                    CLUSTER                      AUTHINFO             NAMESPACE
          docker-for-desktop      docker-for-desktop-cluster   docker-for-desktop
          local                   default-cluster              default-admin
          minikube                minikube                     minikube
*         mycluster-context       mycluster                    mycluster-user       default

参考情報

Namespaces Walkthrough
k8s便利コマンド Namespaceを恒久的に変更する方法
kubectlコマンドの使い方(1.4)

7
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
1