diff --git a/charts/airflow/CUSTOM-README.md b/charts/airflow/CUSTOM-README.md new file mode 100644 index 0000000..108eddc --- /dev/null +++ b/charts/airflow/CUSTOM-README.md @@ -0,0 +1,138 @@ + +# Airflow 배포 + +## 1. 배포 방법 + +### 1) 배포시 주의 사항 + +- 배포전 airflow dag를 저장할 git 리포지토리가 생성 필요 +- + +### 2) 배포 방법 + +``` sh +git clone https://github.com/paasup/dip-catalog.git +cd charts/flowise +helm upgrade airflow ./ -f custom-values.yaml --install -n airflow --create-namespace +``` + +## 2.custom-values.yaml 설명 + +- custom-values.yaml에 정의된 값에 대한 설명이다. + +### 1) Pod 설정 + + +| Name | 설명 | 기본값 | +| ---------------------- | ------------------------------------------------------------ | ------ | +| `defaultAirflowRepository` | 오프라인 설치 시에 설정. 내부 저장소 타겟으로 변경 | `"apache/airflow"` | +| `defaultAirflowTag` | 이미지 태그 설정 | '0.5.4' | + + + +### 2) Git Sync 설정 + +- Dag + ``` yaml + dags: + gitSync: + enabled: true + # dag가 저장될 gitea의 repository url, k8s 서비스로 설정한다. + repo: http://gitea-http.platform.svc.cluster.local:3000/dip/airflow-dags.git + branch: master + rev: HEAD + depth: 1 + subPath: "" + credentialsSecret: git-credentials + env: + - name: GIT_SSL_NO_VERIFY + value: "true" + # git 리포지토리의 clone 및 pull 실행 시 사용할 username, password 설정. + # 실행하는 git 이미지의 버전은 v3, v4 2가지가 있고 사용하는 환경변수가 다름. + # 2가지 설정을 하지 않을 시 동작 에러 발생. + extraSecrets: + git-credentials: + data: | + GIT_SYNC_USERNAME: c3Vkb3VzZXI= + GITSYNC_USERNAME: c3Vkb3VzZXI= + GIT_SYNC_PASSWORD: UGFhc2FkbTEyMzQh + GITSYNC_PASSWORD: UGFhc2FkbTEyMzQh + ``` + + +### 3) Volume 설정 + +``` yaml +# Dag의 저장 공간 크기 설정 +dags: + persistence: + enabled: true + size: 5Gi + +# airflow의 dag 동작시 생성되는 log의 저장 공간 크기 설정 +logs: + persistence: + enabled: true + size: 5Gi +``` + +### 3) Ingress 설정 + +#### 3.1) tls 시크릿 직접 생성 + +- flowise에서 ingress 사용을 위해서는 다음과 같이 설정할 수 있다. + + ``` yaml + ingress: + web: + enabled: true + hosts: + - name: "airflow.example.org" + tls: + enabled: true + secretName: "airflow-tls" + ``` + +- ingress 사용을 위해서는 인증서를 secret으로 제공해야한다. 로컬 파일을 이용해 secret을 생성하는 방법은 다음과 같다. + + ``` sh + kubectl create secret tls airflow-tls --cert= --key= -n + ``` + +#### 3.2) cert-manager를 이용한 자동 생성 + +- cert manager를 통해 인증서 자동 생성 시 `custom-values.yaml` 수정한다. +- `ingress.web.annotations.cert-manager.io/cluster-issuer`에 미리 배포된 Cluster Issuer의 이름으로 변경한다. 그리고 + ff + ``` yaml + ingress: + web: + enabled: true + annotations: + cert-manager.io/issuer: "root-ca-issuer" + kubernetes.io/ingress.class: kong + konghq.com/protocols: https + konghq.com/https-redirect-status-code: "301" + hosts: + - name: "airflow.example.org" + tls: + enabled: true + secretName: "airflow-tls" + ``` + +### 4) Postgresql 설정 + +- 내장 postgresql을 사용하여 배포할 수 있다. +- custom-values.yaml + ``` yaml + postgresql: + enabled: true + auth: + enablePostgresUser: true + postgresPassword: postgres # postgres 유저의 패스워드 설정 + primary: + persistence: + enabled: true + size: 8Gi # airflow에서 사용하는 DB의 볼륨 사이즈 설정 + storageClass: "" # DB 볼륨 배포를 위한 storage class 설정 + ``` \ No newline at end of file diff --git a/charts/airflow/custom-values.yaml b/charts/airflow/custom-values.yaml index 29ee67a..189a8fa 100644 --- a/charts/airflow/custom-values.yaml +++ b/charts/airflow/custom-values.yaml @@ -1,6 +1,5 @@ # defaultAirflowRepository: apache/airflow # defaultAirflowTag: "2.10.5" -# airflowVersion: "2.10.5" ingress: web: @@ -13,7 +12,7 @@ ingress: hosts: - name: "airflow.example.org" tls: - enabled: true + enabled: truewrec secretName: "airflow-tls" executor: "KubernetesExecutor" @@ -29,18 +28,15 @@ config: webserver: enable_proxy_fix: 'True' rbac: 'True' - # base_url: https://airflow.example.org default_ui_timezone: kst scheduler: - # However this feature is only recommended for MySQL 8+ and Postgres replicas: 1 dags: persistence: - # Enable persistent volume for storing dags - enabled: false + enabled: true size: 5Gi storageClassName: longhorn accessMode: ReadWriteMany @@ -84,8 +80,14 @@ logs: statsd: enabled: false + postgresql: enabled: true auth: enablePostgresUser: true - postgresPassword: postgres \ No newline at end of file + postgresPassword: postgres + primary: + persistence: + enabled: true + size: 8Gi # airflow에서 사용하는 DB의 볼륨 사이즈 설정 + storageClass: "" \ No newline at end of file