title: spark-submit custom jar on kubernetes fails with: failed to load class
body: <p>I cannot run a custom Spark application on Kubernetes.</p>
  
  <p>I have followed the setup <a href="https://spark.apache.org/docs/latest/running-on-kubernetes.html" rel="nofollow noreferrer">https://spark.apache.org/docs/latest/running-on-kubernetes.html</a> and the steps on examplel like these: <a href="https://towardsdatascience.com/how-to-build-spark-from-source-and-deploy-it-to-a-kubernetes-cluster-in-60-minutes-225829b744f9" rel="nofollow noreferrer">https://towardsdatascience.com/how-to-build-spark-from-source-and-deploy-it-to-a-kubernetes-cluster-in-60-minutes-225829b744f9</a>  and I can run the spark-pi example.</p>
  
  <p>I even recreated the spark image and have it contain my xxx.jar in both /opt/spark/examples/jars and /opt/spark/jars  but still I get the failed to load class issue. Any ideas what I may have missed. This is extra baffling to me because I checked that the jar is part of the image right next to the example jars, and those work fine.</p>
  
  <p>I run spark-submit like this.</p>
  
  <pre><code>bin/spark-submit
  --master k8s://https://localhost:6443
  --deploy-mode cluster
  --conf spark.executor.instances=3
  --conf spark.kubernetes.authenticate.driver.serviceAccountName=spark
  --conf spark.kubernetes.container.image=spark2:latest
  --conf spark.kubernetes.container.image.pullPolicy=Never
  --class com.xxx.Application
  --name myApp
  local:///opt/spark/examples/jars/xxx.jar
  </code></pre>
  
  <p>Update: Added stacktrace:</p>
  
  <pre><code>spark.driver.bindAddress=10.1.0.68 --deploy-mode client --properties-     file /opt/spark/conf/spark.properties --class com.xxx.Application    local:///opt/spark/examples/jars/xxx.jar
  
  20/05/13 11:02:09 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
  
  Error: Failed to load class com.xxx.Application.
  log4j:WARN No appenders could be found for logger (org.apache.spark.util.ShutdownHookManager).
  </code></pre>
  
  <p>Thanks!</p>