리눅스 kubectl GKE 클러스터 접근

1 개요[ | ]

리눅스 kubectl GKE 클러스터 접근

2 사전작업[ | ]

3 본작업[ | ]

gcloud init
# gcloud container clusters list
NAME      LOCATION           MASTER_VERSION       MASTER_IP      MACHINE_TYPE  NODE_VERSION         NUM_NODES  STATUS
cluster1  asia-northeast3-b  1.27.11-gke.1062003  34.56.178.290  e2-medium     1.27.11-gke.1062003  2          RUNNING
gcloud container clusters get-credentials 클러스터명 --region=리전
또는
gcloud container clusters get-credentials 클러스터명
gcloud init할 때 지정한 디폴트 리전과 같다면, 리전을 생략해도 된다.
root@wsl:~# gcloud container clusters get-credentials cluster1 --region=asia-northeast3-b
Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster1.
root@wsl:~# kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://34.56.178.290
  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
      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
root@wsl:~# 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 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}