LoginSignup
8
6

More than 5 years have passed since last update.

kubectlで接続先AKSクラスターを切り替える方法

Posted at

複数のAzure Kubernetes Serviceを運用する際のメモです。

接続先クラスターの追加方法

az aks get-credentials -g [Resource Group Name] -n [AKS Cluster Name]

操作するクラスターの切り替え方法

  • 登録されているコンテキストを確認します。CURRENTに*が付いているクラスターが現在操作対象になってます。
$ kubectl config get-contexts
CURRENT   NAME                CLUSTER             AUTHINFO                                   NAMESPACE
*         k8s-cluster-1       k8s-cluster-1       clusterUser_k8s-cluster_k8s-cluster-1
          k8s-cluster-2       k8s-cluster-2       clusterUser_k8s-cluster_k8s-cluster-2
  • k8s-cluster-2に切り替えます。
$ kubectl config use-context k8s-cluster-2
8
6
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
8
6