> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ale.run/llms.txt
> Use this file to discover all available pages before exploring further.

# 준비사항

> GKE 클러스터에 ale을 설치하기 위한 준비사항입니다.

<Info>
  **안내**

  * 이 가이드는 **Kubernetes v1.30** 기준으로 작성되었습니다.
</Info>

***

## 도구 설치

<Warning>
  Windows의 경우 WSL2를 설치하여 Linux 환경에서 ale을 이용하는 것을 권장합니다.
  [여기](https://learn.microsoft.com/ko-kr/windows/wsl/install)를 참고하여 WSL2를 먼저 설치하세요.
</Warning>

<AccordionGroup>
  <Accordion title="gcloud CLI">
    다음의 명령어를 입력하여 gcloud CLI를 설치하고 쉘을 제시작하세요.

    ```bash theme={null}
    curl https://sdk.cloud.google.com | bash
    exec -l $SHELL
    ```

    다음의 명령어를 입력하여 `gke-gcloud-auth-plugin` 를 설치합니다.

    ```bash theme={null}
    gcloud components install gke-gcloud-auth-plugin
    ```
  </Accordion>

  <Accordion title="kubectl">
    사용하고 있는 OS 및 아키텍처에 맞게 kubectl을 설치합니다.

    **macOS**

    <CodeGroup>
      ```bash macOS(Apple Silicon) theme={null}
      curl -LO "https://dl.k8s.io/release/v1.30.2/bin/darwin/arm64/kubectl"
      ```

      ```bash macOS(Intel) theme={null}
      curl -LO "https://dl.k8s.io/release/v1.30.2/bin/darwin/amd64/kubectl"
      ```
    </CodeGroup>

    **Linux**

    <CodeGroup>
      ```bash Linux(x86-64) theme={null}
      curl -LO https://dl.k8s.io/release/v1.30.2/bin/linux/amd64/kubectl
      ```

      ```bash Linux(arm64) theme={null}
      curl -LO https://dl.k8s.io/release/v1.30.2/bin/linux/arm64/kubectl
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="helm">
    ```bash theme={null}
    curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
    chmod 700 get_helm.sh
    ./get_helm.sh  
    ```
  </Accordion>
</AccordionGroup>

***

## Google Cloud 계정 설정

### gcloud CLI 초기화

<Steps>
  <Step title="사용할 Google 계정과 Region 및 Zone을 등록하기 위해 다음의 명령어를 실행하세요.">
    ```bash theme={null}
    gcloud init
    ```
  </Step>

  <Step title="프롬프트에 `Sign in with a new Google Account`에 해당되는 숫자값을 입력하여 Google 계정에 로그인합니다.이미 로그인 된 계정을 사용하는 경우 해당 숫자값을 입력하세요.">
    ```bash theme={null}
      Choose the account you want to use for this configuration.
      To use a federated user account, exit this command and sign in to the gcloud CLI with your login configuration file, then run this command again.

      Select an account:
        [1] Sign in with a new Google Account
        [2] Skip this step
      Please enter your numeric choice: 
    ```
  </Step>

  <Step title="Google Cloud는 프로젝트를 단위로 하여 리소스를 할당하고 사용합니다. `Create a new project`에 해당되는 숫자값을 입력하여 새로운 프로젝트를 생성하세요. 만약 기존에 생성된 프로젝트를 사용하는 경우 해당 숫자값을 입력합니다.">
    ```bash theme={null}
    Pick cloud project to use:
     [1] Enter a project ID
     [2] Create a new project
    Please enter numeric choice or text value (must exactly match list item):  
    ```
  </Step>

  <Step title="Region 및 Zone의 기본값을 지정하는지 묻는 프롬프트에 y를 입력하고 기본값으로 지정할 Region/Zone에 해당하는 숫자값을 입력합니다.">
    ```bash theme={null}
    Do you want to configure a default Compute Region and Zone? (Y/n)?   y

    Which Google Compute Engine zone would you like to use as project default?
    If you do not specify a zone via a command line flag while working with Compute Engine resources, the default is assumed.
     [1] us-east1-b
     [2] us-east1-c
     [3] us-east1-d
     [4] us-east4-c
     [5] us-east4-b
     [6] us-east4-a
     [7] us-central1-c
     [8] us-central1-a
     [9] us-central1-f
     [10] us-central1-b
     [11] us-west1-b
     [12] us-west1-c
     [13] us-west1-a
    ...
    Did not print [75] options.
    Too many options [125]. Enter "list" at prompt to print choices fully.
    Please enter numeric choice or text value (must exactly match list item):
    ```

    <Info>
      다음과 같이 표시되면 정상 처리된 것입니다.

      ```bash theme={null}
      ...
      The Google Cloud CLI is configured and ready to use!

      * Commands that require authentication will use ale@example.com by default
      * Commands will reference project `ale` by default
      * Compute Engine commands will use region `asia-northeast3` by default
      * Compute Engine commands will use zone `asia-northeast3-a` by default
      ...
      ```
    </Info>
  </Step>
</Steps>

### 환경변수 등록

> 위에서 생성한 프로젝트 ID, Region, 클러스터 이름 및 노드가 위치할 Zone을 환경변수로 등록하세요.

```bash theme={null}
export GCP_PROJECT_ID=<GCP 프로젝트 ID>
export GCP_REGION=<GCP 리전>
export NODE_LOCATIONS=<클러스터 노드가 위치할 zone> 
export CLUSTER_NAME=<생성할 GKE 클러스터명>
```

### gcloud 계정 및 프로젝트 설정

<Steps>
  <Step title="다음의 명령어를 입력하여 Google 계정에 로그인합니다.">
    ```bash theme={null}
    gcloud auth login
    ```

    <Info>
      자동으로 브라우저가 실행된 후 Google 계정 로그인을 위한 페이지가 표시됩니다.
      브라우저에서 로그인 작업을 마치면 터미널에서 로그인이 완료되었다는 메세지를 확인할 수 있습니다.
    </Info>
  </Step>

  <Step title="이어서 프로젝트를 설정하기 위해 다음의 명령어를 실행하세요.">
    ```bash theme={null}
    gcloud config set project $GCP_PROJECT_ID
    ```
  </Step>
</Steps>

>
