윈도우 kubectl GKE 클러스터 접근

1 개요[ | ]

kubectl GKE 클러스터 접근

2 사전작업[ | ]

3 본작업[ | ]

gcloud container clusters get-credentials 클러스터명 --region=리전
또는
gcloud container clusters get-credentials 클러스터명
gcloud init할 때 지정한 디폴트 리전과 같다면, 리전을 생략해도 된다.
C:\Users\user>gcloud container clusters get-credentials cluster1
Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster1.
C:\Users\user>kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://34.56.78.90
  name: gke_project1_asia-northeast3-b_cluster1
contexts:
- context:
    cluster: gke_project1_asia-northeast3-b_cluster1
    user: gke_project1_asia-northeast3-b_cluster1
  name: gke_project1_asia-northeast3-b_cluster1
current-context: gke_project1_asia-northeast3-b_cluster1
kind: Config
preferences: {}
users:
- name: gke_project1_asia-northeast3-b_cluster1
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args: null
      command: gke-gcloud-auth-plugin.exe
      env: null
      installHint: Install gke-gcloud-auth-plugin for use with kubectl by following
        https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_plugin
      interactiveMode: IfAvailable
      provideClusterInfo: true
C:\Users\user>kubectl get no
NAME                                 STATUS   ROLES    AGE    VERSION
gke-cluster1-worker1-c2b5d85e-8wd5   Ready    <none>   14h    v1.27.11-gke.1062003
gke-cluster1-worker1-c2b5d85e-bcs8   Ready    <none>   14h    v1.27.11-gke.1062003

4 같이 보기[ | ]

5 참고[ | ]

  1. GKE 문서에는 kubectl을 gcloud components install kubectl로 설치하도록 안내되어 있지만, 다음 방법(예: winget install kubectl)로 설치해도 된다.
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}