개요
mac에 airflow on k8s 개발 환경을 꾸리고자 helm으로 배포하려 합니다.
전 k3s 기반 rancher 를 통해 쿠버네티스 환경을 세팅했습니다.
Rancher desktop 사용하기 - MAC m4
개요기본 podman-desktop을 이용하여 컨테이너 개발 환경을 꾸렸는데 아쉬운 점이 많아 Rancher desktop으로 대체하고자 한다. podman desktop 의 아쉬운 점1. 절전 모드 후 컨테이너 좀비화- 이게 가장 큰
tomin.tistory.com
사전환경
쿠버네티스, helm
설치
1. airflow helm chart 다운로드
https://github.com/apache/airflow
GitHub - apache/airflow: Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
Apache Airflow - A platform to programmatically author, schedule, and monitor workflows - apache/airflow
github.com
위 공식 git repo 에 있는 chart를 이용했습니다. chart 디렉터리 하위가 helm에 관한 부분입니다.
그대로 배포하셔도 동작하겠지만, 전 개발 용도이기 때문에 dag와 log 디렉토리를 로컬 pc의 경로에 마운트 진행했습니다.
2. dag 와 log의 pv와 pvc 생성
mac의 폴더와 airflow 내 dag 및 log 폴더를 마운트 진행해 줬습니다.
전 아래처럼 PV 와 PVC 파일을 작성했습니다.
# dags-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: dags-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: <절대경로>
# dags-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dags-pvc
namespace: airflow
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
# logs-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: logs-pv
labels:
type: local
spec:
storageClassName: logs
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
hostPath:
path: <log 절대경로>
# logs-pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: logs-pvc
namespace: airflow
spec:
storageClassName: logs
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
네임스페이스와 PV, PVC를 생성해 줍니다.
kubectl create ns airflow
kubectl apply -f logs-pv.yaml
kubectl apply -f logs-pvc.yaml -n airflow
kubectl apply -f dags-pv.yaml
kubectl apply -f dags-pvc.yaml -n airflow
아래 커맨드로 확인했을 때 pv와 pvc 가 연결되어 있으면 정상입니다.
만약 연결되지 않는다면 yaml에 storageClassName 값이 pv와 pvc 가 일치하도록 하시면 됩니다.
kubectl get pvc -n airflow
3. helm value 수정
이제 만들어둔 dag와 log를 config에 명시하는 작업이 필요합니다.
values.yaml 내에 내용을 수정합니다.
dags와 logs 하위에 각각 enabled와 existingClaim 부분을 수정합니다. existingClaim는 만든 pvc 명으로 하면 됩니다.
4. 배포
chart 디렉터리 내에서 아래와 같은 커맨드로 배포합니다.
helm upgrade --install airflow . -n airflow
끝.
'IT 기술 > 데이터엔지니어링' 카테고리의 다른 글
DuckDB 란? DuckDB + Postgresql 활용 (Python) (0) | 2025.03.10 |
---|---|
[Spark] Structured Streaming으로 실시간 데이터 처리하기 - Databricks 활용 (0) | 2024.12.16 |
[Spark] Spark 실행 방식 - SparkDriver, ClusterManager (1) | 2024.12.05 |
[Spark] Shuffle 이란? - Wide Transformation, Narrow Transformation (0) | 2024.11.28 |
[Spark]UDF 의 정의 및 사용 방법 + UDF 별 수행 속도차이(PySpark)- 24.11 (1) | 2024.11.27 |