kubectl config get-clusters


개요

kubectl config get-clusters

예시 1

testuser@localhost:~$ kubectl config get-clusters
NAME
project1_korea-seoul-a_cluster1
testuser@localhost:~$ cat ~/.kube/config | grep cluster:
- cluster:
    cluster: project1_korea-seoul-a_cluster1

예시 2

testuser@localhost:~$ kubectl config get-clusters
NAME
project1_korea-seoul-a_cluster1
gke_my-project-802_asia-northeast3-b_cluster2
testuser@localhost:~$ echo $KUBECONFIG
/home/testuser/.kube/clusters/cluster1:/home/testuser/.kube/clusters/cluster2
testuser@localhost:~$ kubectl config view | grep '^- cluster:' -A3 | grep name:
  name: project1_korea-seoul-a_cluster1
  name: gke_my-project-802_asia-northeast3-b_cluster2
testuser@localhost:~$ kubectl config get-contexts
CURRENT   NAME                CLUSTER                                         AUTHINFO     NAMESPACE
*         context1            project1_korea-seoul-a_cluster1                 admin-user
          testuser@cluster2   gke_my-project-802_asia-northeast3-b_cluster2   testuser

같이 보기