6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Windows10での~/.kube/config

Posted at

そもそもkubectlがkubeconfigとして読み込む順番

こちらを参考にさせて頂きました
ありがとうございます

  1. --kubeconfig フラグで指定されたパス
  2. $KUBECONFIG 環境変数に指定されたパス一覧
  3. ~/.kube/config

Windows10での~/.kube/config

kubeconfig、Linuxでいう~/.kube/config
このファイルにkubernetesクラスタのクレデンシャル情報をそのまま突っ込んであげればよいはず
デフォルトはここ

%USERPROFILE%.kube\config

kubeconfigの中身を確認する

kubectl config viewで表示される内容が、kubectl打った時に読み込まれてるやつ
なので、オプション付けたり環境変数に設定を入れてなければ、%USERPROFILE%.kube\configと同じクラスタの情報になるはず
逆にこれで違うクラスタの情報が表示されたら、環境変数が怪しいということになる

PS C:\> kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://xxx.com:6443
  name: cluster01
contexts:
- context:
    cluster: cluster01
    user: cluster01-xxx-user
  name: cluster01-context
current-context: cluster01-context
kind: Config
preferences: {}
users:
- name: cluster01-xxx-user
  user:
    token: 省略

その他の似たようなコマンド

今のところ、あんまり役立った記憶は無いですが…

kubectl config get-clusters

PS C:\> kubectl config get-clusters
NAME
cluster01

kubectl config get-contexts

PS C:\> kubectl config get-contexts
CURRENT   NAME                CLUSTER     AUTHINFO                NAMESPACE
*         cluster01-context   cluster01   cluster01-xxx-user

kubectl cluster-info

PS C:\> kubectl cluster-info
Kubernetes master is running at https://xxx.com:6443
KubeDNS is running at https://c-xxx.com:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
6
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
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?