<p>I am facing an issue while reading a file stored in my system in spark cluster mode program.It is giving me an error that "File not found" but file is present at defined location.Please suggest me some idea so that i can read local file in spark cluster using kubernetes.</p>

harshit saxena
<p>You cannot refer local files on your machine when you submit Spark on Kubernetes. </p>

<p>The available solutions for your case might be:</p>

<ul>
<li>Use <a href="https://apache-spark-on-k8s.github.io/userdocs/running-on-kubernetes.html#dependency-management" rel="noreferrer">Resource staging server</a>. Is not available in the main branch of Apache Spark codebase, so the whole integration is on your side.</li>
<li>Put your file to the http/hdfs accessible location: refer <a href="https://spark.apache.org/docs/latest/running-on-kubernetes.html#dependency-management" rel="noreferrer">docs</a></li>
<li>Put your file inside Spark Docker image and refer it as <code>local:///path/to/your-file.jar</code></li>
</ul>

<p>If you are running local Kubernetes cluster like Minikube you can also create a Kubernetes Volume with files you are interested in and mount it to the Spark Pods: refer <a href="https://spark.apache.org/docs/latest/running-on-kubernetes.html#using-kubernetes-volumes" rel="noreferrer">docs</a>. Be sure to mount that volume to both Driver and Executors.</p>
