2

https://www.astronomer.io/events/recaps/official-airflow-helm-chart
I followed the tutorial to build a airflow on Windows 10 WSL2 docker desktop, and I want to mount a local persistence dags folder. I tried and got nothing in my dag folder, and no error message either.

What is a correct setting of values.yaml, pv.yaml and pvc.yaml to mount a local persistence dags folder?

My helm values.yaml, pv.yaml, and pvc.yaml are list in the end, and I listed the params I used.
My airflow dag folder is at: c:\airflow-home\dags\pipelines

I have tried these article to mount my dag folder below(all was failed, no errors, and dag folder in vm still empty):

  1. https://stackoverflow.com/a/63524931/16933247
  2. https://github.com/docker/for-win/issues/5325#issuecomment-570683131
  3. https://stackoverflow.com/a/55397228/16933247

values.yaml

dags:
  persistence:
    # Enable persistent volume for storing dags
    enabled: true
    # Volume size for dags
    size: 10Gi
    # If using a custom storageClass, pass name here
    storageClassName: 
    # access mode of the persistent volume
    accessMode: ReadWriteOnce
    ## the name of an existing PVC to use
    existingClaim: local-dags-folder

pv.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-dags-folder
  namespace: airflow
  labels:
    type: local
spec:
  storageClassName: local-storage
  capacity:
    storage: 10Gi
  accessModes:
    ###############
    # What should I use?
    #- ReadWriteOnce
    #- ReadWriteMany
    ###############
    - ReadWriteOnce
  ###############
  # What should I use? hostPath or Filesystem
  ###############
  volumeMode: Filesystem
  local:
    ###############
    #I tried this and no use
    #path: /run/desktop/mnt/host/c/airflow-home/dags/pipelines
    ###############
    path: /c/airflow-home/dags/pipelines
  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
                ###############
                # I tried `docker-desktop` and get a error, so change to `kind-control-plane`
                ###############
                - kind-control-plane

pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-dags-folder
  namespace: airflow
spec:
  storageClassName: local-storage
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

1 Answers1

0

I ran into similar issue and below is the solution that worked. Make sure WSL is enabled on Docker windows. Use local path as /run/desktop/mnt/host/c/airflow-home/dags/pipelines

pv.yaml file

apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-dags-folder
  namespace: airflow
  labels:
    type: local
spec:
  storageClassName: local-path
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteMany
  volumeMode: Filesystem
  local:
    path: /run/desktop/mnt/host/c/airflow

  nodeAffinity:
    required:
      nodeSelectorTerms:
        - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
                - docker-desktop

pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-dags-folder
  namespace: airflow
spec:
  storageClassName: local-path
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 2Gi

airflow helm values.yml file

dags:
  persistence:
    enabled: true
    size: 2Gi
    storageClassName: docker-desktop
    accessMode: ReadWriteMany
    existingClaim: local-dags-folder
Mithun Manohar
  • 516
  • 1
  • 6
  • 18