<p>I am toying with the spark operator in kubernetes, and I am trying to create a Spark Application resource with the following manifest.</p>
<pre><code>apiVersion: &quot;sparkoperator.k8s.io/v1beta2&quot;
kind: SparkApplication
metadata:
  name: pyspark-pi
  namespace: spark-jobs
spec:
  batchScheduler: volcano
  batchSchedulerOptions:
    priorityClassName: routine
  type: Python
  pythonVersion: &quot;3&quot;
  mode: cluster
  image: &quot;&lt;image_name&gt;&quot;
  imagePullPolicy: Always
  mainApplicationFile: local:///spark-files/csv_data.py
  arguments:
  - &quot;10&quot;
  sparkVersion: &quot;3.0.0&quot;
  restartPolicy:
    type: OnFailure
    onFailureRetries: 3
    onFailureRetryInterval: 10
    onSubmissionFailureRetries: 5
    onSubmissionFailureRetryInterval: 20
  timeToLiveSeconds: 86400
  driver:
    cores: 1
    coreLimit: &quot;1200m&quot;
    memory: &quot;512m&quot;
    labels:
      version: 3.0.0
    serviceAccount: driver-sa
    volumeMounts:
    - name: sparky-data
      mountPath: /spark-data
  executor:
    cores: 1
    instances: 2
    memory: &quot;512m&quot;
    labels:
      version: 3.0.0
    volumeMounts:
    - name: sparky-data
      mountPath: /spark-data
  volumes:
  - name: sparky-data
    hostPath:
      path: /spark-data
</code></pre>
<p>I am running this in kind, where I have defined a volume mount to my local system where the data to be processed is present. I can see the volume being mounted in the kind nodes. But when I create the above resource, the driver pod crashes by giving the error 'no such path'. I printed the contents of the root directory of the driver pod and I could not see the mounted volume. What is the problem here and how do I fix this?</p>

imawful
<p>The issue is related to permissions. When mounting a volume to a pod, you need to make sure that the permissions are set correctly. Specifically, you need to make sure that the user or group that is running the application in the pod has the correct permissions to access the data.You should also make sure that the path to the volume is valid, and that the volume is properly mounted.To check if a path exists, you can use the exec command:</p>
<pre><code>kubectl exec &lt;pod_name&gt; -- ls
</code></pre>
<p>Try to add <a href="https://kubernetes.io/docs/tasks/configure-pod-container/security-context/" rel="nofollow noreferrer">security context</a> which gives privilege and access control settings for a Pod</p>
<p>For more information follow this <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">document</a>.</p>
