question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

git-sync with persistent volume claim

See original GitHub issue

Apache Airflow version: 2.0.2

Kubernetes version: Client Version: v1.17.4, Server Version: v1.18.14

Cloud provider or hardware configuration: Azure

What happened: When using git-sync with persistence enabled, the scheduler pod fails to start.

The command

    kubectl logs airflow2-scheduler-79d7f74f46-sgd6h -c git-sync

gives

    INFO: detected pid 1, running init handler
    I0426 20:32:38.953393      11 main.go:321]  "level"=0 "msg"="starting up"  "args"=["/git-sync"] "pid"=11
    I0426 20:32:38.957866      11 main.go:574]  "level"=0 "msg"="cloning repo"  "origin"="git@github.com:Cybrik/airflow2-dags.git" "path"="/git"
    E0426 20:32:40.633376      11 main.go:347]  "msg"="failed to sync repo, aborting" "error"="error running command: exit status 128: { stdout: \"\", stderr: \"Cloning into '/git'...\\nerror: chmod on /git/.git/config.lock failed: Operation not permitted\\nfatal: could not set 'core.filemode' to 'false'\\n\" }"  

What you expected to happen:

Airflow deploying correctly

How to reproduce it:

I am using the Helm chart from apache/airflow

create values.yaml with the following content

dags:
persistence:
  enabled: true
  existingClaim: dags
gitSync:
  enabled: true
  repo: "git@github.com:Company/repo.git"
  branch: main
  subPath: ""
  sshKeySecret: airflow-ssh-secret

and a persistent volume claim as follows

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: dags
  labels:
    tier: airflow
    release: airflow2
    heritage: "Helm"
spec:
  accessModes:
    - "ReadWriteMany"
  resources:
    requests:
      storage: "1Gi"
  storageClassName: "azurefile"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
zorzigiocommented, Jul 20, 2021

Solved the issue adding noperm to the StorageClass mountOptions

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: storage-class-test
provisioner: kubernetes.io/azure-file
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict
  - actimeo=30
  - noperm
parameters:
  skuName: Standard_LRS
0reactions
zorzigiocommented, Jul 20, 2021

@jedcunningham finally I got round to try this.

I created a custom storage class using

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: storage-class-test
provisioner: kubernetes.io/azure-file
mountOptions:
  - dir_mode=0777
  - file_mode=0777
  - uid=0
  - gid=0
  - mfsymlinks
  - cache=strict
  - actimeo=30
parameters:
  skuName: Standard_LRS

and a persistent volume claim using

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: dags-test
  labels:
    tier: airflow
    release: airflow
    heritage: "Helm"
spec:
  accessModes:
    - "ReadWriteMany"
  resources:
    requests:
      storage: "1Gi"
  storageClassName: "storage-class-test"

Then in the values.yaml

dags:
  persistence:
    enabled: true
    existingClaim: dags-test
  gitSync:
    enabled: true
    repo: "git@github.com:Company/dags.git"
    branch: main
    dest: "dags_repo"
    subPath: ""
    sshKeySecret: airflow-ssh-secret

I am still getting the same error

>kubectl logs airflow-scheduler-bfcc8668d-fh9kb -c git-sync 
INFO: detected pid 1, running init handler
I0720 21:32:53.092295      10 main.go:495]  "level"=0 "msg"="starting up"  "args"=["/git-sync"] "pid"=10
I0720 21:32:53.100652      10 main.go:784]  "level"=0 "msg"="cloning repo"  "origin"="git@github.com:Company/dags.git" "path"="/git"
E0720 21:32:56.598086      10 main.go:168]  "msg"="too many failures, aborting" "error"="Run(git clone --no-checkout -b main --depth 1 git@github.com:Company/dags.git /git): exit status 128: { stdout: \"\", stderr: \"Cloning into '/git'...\\nerror: chmod on /git/.git/config.lock failed: Operation not permitted\\nfatal: could not set 'core.filemode' to 'false'\\n\" }"  "failCount"=0

Any idea?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need support on using git-sync and persistent volumes
I am trying to use git-sync to write data from a gitlab repo to a persistent volume, then pull that data into another...
Read more >
[stable/airflow] git sync is broken if shared pvc is used ... - GitHub
Setup an NFS volume using stable/nfs-server-provisioner and created a persistentVolumeClaim called airflow-dags with ReadWriteMany ...
Read more >
[GitHub] [airflow] zorzigio opened a new issue #15540: git-sync with ...
... zorzigio opened a new issue #15540: git-sync with persistent volume claim ... using git-sync with persistence enabled, the scheduler pod fails to...
Read more >
Configure a Pod to Use a PersistentVolume for Storage
After you create the PersistentVolumeClaim, the Kubernetes control plane looks for a PersistentVolume that satisfies the claim's requirements.
Read more >
airflow 7.14.1 · airflow-helm/airflow-helm - Artifact Hub
gitSync.refreshTime seconds. ... this method requires a PersistentVolumeClaim which supports accessMode : ReadOnlyMany or ReadWriteMany.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found