3ee1c1ee23
이슈 #9에서 결정된 CloudNativePG 채택을 카탈로그 앱에 확장 적용한다. airflow/lakekeeper/mlflow/superset/flowise 5개 차트가 내장하던 bitnami postgresql 서브차트를 끄고 앱 전용 cnpg-cluster 인스턴스를 외부 DB로 쓰도록 전환했다. 5개 모두 dev 클러스터 격리 네임스페이스에서 배포 테스트로 실측 검증했다. gitea/keycloak/dnsup 는 서브차트가 아니라 공유 postgresql-ha 를 외부 참조하며 paasup/dipup 레포 관리 대상이라 제외했다 — 인수인계 문서만 추가했다. 배포 구조: - ArgoCD ApplicationSet 으로 DB(syncWave 0) → 앱(syncWave 1) 순서를 보장한다. 기존 openmetadata/victoria-metrics 관례를 따랐다. cnpg-cluster 차트는 범용 상태로 유지하고 앱별 값은 manifests/applicationset/<app>/ 에 둔다. 검증 중 발견해 함께 고친 문제: - lakekeeper: cnpg 의 -ro 는 replica 전용이라 instances:1 에서 엔드포인트가 0개다. 읽기 연결을 -r(전체 라운드로빈)로 교체했다. - airflow/superset: ingressClassName 누락 + kong 애노테이션 잔존으로 이 클러스터(apisix 전용)에서 ingress 접근이 아예 불가능했다. apisix + regex path 로 교체했다. - 배포 테스트가 PV 만 지우고 Longhorn Volume CR 을 남겨 storageScheduled 가 누적됐다(orphan 112개 ~1TB 로 배포 차단). 두 스크립트의 정리 로직을 고쳤다. 재사용 구조화: - .claude/skills/chart-to-cnpg/ 신규. 남은 4개 차트(langflow-ide, langfuse, litellm, nemo)에 같은 절차를 재사용한다. flowise 에 실제 적용해 검증했다. - 배포 테스트 공통 절차는 .claude/deploy-test-procedure.md, 환경 함정은 .claude/pitfalls.md 로 단일화하고 앱별 README 는 참조만 남겼다. 관련: #9, #14 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
161 lines
4.9 KiB
Markdown
161 lines
4.9 KiB
Markdown
|
|
# 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=<path-to-cert-file> --key=<path-to-key-file> -n <namespace>
|
|
```
|
|
|
|
#### 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 설정
|
|
|
|
- 내장 bitnami postgresql 서브차트 대신, `cnpg-cluster`(전용 인스턴스)를 외부 DB로 사용한다.
|
|
- **사전 조건**: `cloudnative-pg` operator(`manifests/helm/cloudnative-pg/0.29.0`)가 클러스터에
|
|
먼저 설치되어 있어야 한다.
|
|
- **배포 순서**
|
|
``` sh
|
|
# 1) airflow용 DB 계정 시크릿 생성 (아래 password는 metadataConnection.pass와 동일해야 한다)
|
|
kubectl create secret generic airflow-db-app-secret \
|
|
--from-literal=username=airflow --from-literal=password=airflow -n airflow
|
|
|
|
# 2) 전용 cnpg-cluster 배포
|
|
helm upgrade airflow-db manifests/helm/cnpg-cluster/1.0.0 \
|
|
-f manifests/helm/cnpg-cluster/1.0.0/custom-values.yaml \
|
|
-f manifests/applicationset/airflow/1.16.0/airflow-db-values.yaml \
|
|
--install -n airflow
|
|
|
|
# 3) airflow 배포 (기존 배포 방법과 동일)
|
|
helm upgrade airflow ./ -f custom-values.yaml --install -n airflow --create-namespace
|
|
```
|
|
- ArgoCD로 배포한다면 `manifests/applicationset/airflow/1.16.0/`의 ApplicationSet을 쓴다 —
|
|
`airflow-db`(syncWave 0) → `airflow`(syncWave 1) 순서로 자동 배포된다. 자세한 내용은
|
|
해당 디렉토리의 `README.md` 참고.
|
|
- custom-values.yaml
|
|
``` yaml
|
|
postgresql:
|
|
enabled: false
|
|
|
|
data:
|
|
metadataConnection:
|
|
user: airflow
|
|
pass: airflow # 위 시크릿 생성 시 사용한 password와 동일해야 한다
|
|
protocol: postgresql
|
|
host: airflow-db-rw # cnpg-cluster 릴리스명이 airflow-db일 때의 rw 서비스명
|
|
port: 5432
|
|
db: airflow
|
|
sslmode: disable
|
|
```
|
|
- 참고: `manifests/applicationset/airflow/1.16.0/airflow-db-values.yaml` |