"리눅스 kubectl GKE 클러스터 접근"의 두 판 사이의 차이

6번째 줄: 6번째 줄:
* [[리눅스 gcloud CLI 설치]]([[데비안/우분투 gcloud CLI 설치]])
* [[리눅스 gcloud CLI 설치]]([[데비안/우분투 gcloud CLI 설치]])
* [[리눅스 gke-gcloud-auth-plugin 설치]]
* [[리눅스 gke-gcloud-auth-plugin 설치]]
==본작업==
<syntaxhighlight lang='bash'>
gcloud auth login
</syntaxhighlight>
<syntaxhighlight lang='console'>
cloud config set project 프로젝트_아이디
</syntaxhighlight>
<syntaxhighlight lang='dos'>
gcloud container clusters get-credentials 클러스터명 --region=리전
또는
gcloud container clusters get-credentials 클러스터명
</syntaxhighlight>
:→ [[gcloud init]]할 때 지정한 디폴트 리전과 같다면, 리전을 생략해도 된다.
<syntaxhighlight lang='doscon'>
C:\Users\user>gcloud container clusters get-credentials cluster1
Fetching cluster endpoint and auth data.
kubeconfig entry generated for cluster1.
</syntaxhighlight>
<syntaxhighlight lang='doscon'>
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
</syntaxhighlight>
<syntaxhighlight lang='doscon'>
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
</syntaxhighlight>


==같이 보기==
==같이 보기==

2024년 5월 26일 (일) 13:57 판

1 개요

리눅스 kubectl GKE 클러스터 접근

2 사전작업

3 본작업

gcloud auth login
cloud config set project 프로젝트_아이디
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 참고

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