<p>I'm fairly new to Kubernetes so apologies for any mixups in terminology.</p>
<p>I'm using the official Airflow helm chart to create a development environment, and have my Dogs (and other) folders in a NFS volume on my local machine. I have configured the <code>values.yaml</code> like so (same for both the scheduler and worker):</p>
<pre><code>  # Mount additional volumes into scheduler.
  extraVolumes:
    - name: dags
      nfs:
        server: '10.106.0.113'
        path: '/home/dev/projects/airflow-jobs/dags'
    - name: plugins
      nfs:
        server: '10.106.0.113'
        path: '/home/dev/projects/airflow-jobs/plugins'
    - name: scripts
      nfs:
        server: '10.106.0.113'
        path: '/home/dev/projects/airflow-jobs/scripts'
  extraVolumeMounts:
    - mountPath: '/opt/airflow/dags'
      name: 'dags'
    - mountPath: '/opt/airflow/plugins'
      name: 'plugins'
    - mountPath: '/opt/airflow/scripts'
      name: 'scripts'
</code></pre>
<p>When I then spin this up, only one of the scheduler or worker pod will mount the volume successfully - the other will fail with the following message:</p>
<pre><code>&gt; kubectl describe pod airflow-worker-0

Warning FailedMount 2s kubelet Unable to attach or mount volumes: unmounted volumes=[dags plugins scripts], unattached volumes=[dags plugins scripts logs config kube-api-access-dnsjx]: timed out waiting for the condition
</code></pre>
<p>Why am I receiving this error - is it not possible to have two pods using the same NFS store? I had this working before using the same <code>values.yaml</code> file so I don't quite know what has changed!</p>

SeeBeeOss
<p>Figured it out - it was due to the NFS mount being configured as ReadWriteOnce. As per the documentation <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer">here</a>, this <em>does</em> allow multiple pods to access the volume, but <em>only if they are located on the same node</em>. So what was happening is that my Scheduler pod would spin up first, mount the volume, and then when the Worker pod followed it would be unable to do so because the Scheduler had reserved the volume. By coincidence, the first time I deployed these two pods must have been assigned the same node.</p>
<p>The simplest solution here would be to mount this as ReadWriteMany, but as I have limited permissions to my cluster and development environment, I simply made some changes to my deployment to ensure that the pods that needed access to this volume were on the same node. Plus, learning experience!</p>
<ol>
<li>First - get the nodes that each pod is assigned to using <code>kubectl get pods -o wide</code>.</li>
<li>Get all the nodes in the cluster <code>kubectl get nodes --show-labels</code></li>
<li>Pick a node to assign the two pods that need to share the NFS mount to. This was arbitrary, so lets call it &quot;node123&quot;.</li>
<li>Update the labels of the node <code>kubectl label nodes node123 airflow=nfs</code></li>
<li>Finally, in the values.yaml file, specify the nodeSelector property for the Scheduler and Worker nodes!</li>
</ol>
<pre><code>  # Select certain nodes for airflow worker pods.
  nodeSelector: 
    airflow: nfs
</code></pre>
<p>Then re-deploy the chart, and everything works as intended!</p>
