> ## 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.

# ale 설치

> GKE 클러스터에 ale을 설치하고 초기세팅을 진행하는 가이드입니다.

***

## ale 구성요소 설치

> 다음의 kubectl 명령어로 ale을 설치하세요.

```bash theme={null}
kubectl apply -f https://raw.githubusercontent.com/ale-run/ale/refs/heads/main/k8s/dist/latest/ale.yaml
```

<Info>
  배포 작업의 완료는 다음의 명령어로 확인할 수 있으며, STATUS가 모두 Running인 경우 설치가 완료된 것입니다.

  ```bash theme={null}
  kubectl get pod -n ale
  ```

  ```bash theme={null}
  NAME                             READY   STATUS    RESTARTS   AGE
  ale-agent-77dbd775c8-rtqzc       1/1     Running   0          165m
  ale-controller-bf5c46899-8lrgt   1/1     Running   0          57m
  mongodb-0                        1/1     Running   0          165m
  ```
</Info>

<Note>
  클러스터 상황에 따라 설치에 시간이 다소 소요될 수 있습니다.
  만약 긴 시간이 경과 했음에도 STATUS가 Running 상태로 변경되지 않거나 pod 구동에 실패하는 경우 `kubectl describe pod <pod 이름> -n ale` 명령어로 구체적인 원인을 확인해 주세요.
</Note>

## ale 데이터베이스 설정(선택)

> `ale`은 기본적으로 클러스터에 StatefulSet 으로 배포된 `mongodb`를 사용합니다. 만약 다른 데이터베이스를 사용하고 싶다면 다음과 같이 명령어를 입력하세요.

* MongoDB Atlas 기준

  ```bash theme={null}
  export DB_USERNAME=[DB 사용자명]
  export DB_PASSWORD=$(echo '[DB 패스워드]' | jq -Rr @uri)
  export DB_NAME=[DB 이름]

  kubectl patch secret ale-secrets -n ale \
    -p '{"data": {"DB_URL": "'$(echo -n "mongodb+srv://${DB_USERNAME}:${DB_PASSWORD}@cluster0.nbyq0.mongodb.net/${DB_NAME}?retryWrites=true&w=majority&appName=Cluster0" | base64)'"}}'
  kubectl rollout restart deployment ale-controller -n ale
  ```
