Using a k8s cluster as spark cluster manager on Spark 2.3.0

3/15/2018

I was trying to submit a example job to k8s cluster from binary release of spark 2.3.0, the submit command is shown below. However, I have met an wrong master error all the time. I am really sure my k8s cluster is working fine.

bin/spark-submit \
    --master k8s://https://<k8s-master-ip> \
    --deploy-mode cluster \
    --name spark-pi \
    --class org.apache.spark.examples.SparkPi \
    --conf spark.executor.instances=3 \
    --conf spark.kubernetes.container.image= <image-built-from-dockerfile> \
    --conf spark.kubernetes.driver.pod.name=spark-pi-driver \
    local:///opt/examples/jars/spark-examples_2.11-2.3.0.jar

and the error comes out

Error: Master must either be yarn or start with spark, mesos, local

and this is the output of kubectl cluster-info

Kubernetes master is running at https://192.168.0.10:6443
KubeDNS is running at https://192.168.0.10:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
-- Roy
apache-spark
kubernetes

1 Answer

4/8/2018

because i am not good at English. so maybe have some wrong grammar. but i will do my best to responds your question. my resolve method is check your $SPARK_HOME and change to your "apache-spark-on-k8s" file path.because spark-submit is default use "${SPARK_HOME}" to run your command.maybe you have two spark environment in the same machine just like me. so command always use your original spark. hope this answer will help you.

-- Mike-Li
Source: StackOverflow