Spark On Kubernetes 提交测试任务

自己在虚拟机上搭建了一个kubernetes测试集群,通过Spark官方文档,提交一个测试任务到kubernetes集群上执行,记录一下:

1. 提交命令:

cluster模式:

$ bin/spark-submit \
    --master k8s://https://ip:port \
    --deploy-mode cluster \
    --name spark-pi \
    --class org.apache.spark.examples.SparkPi \
    --conf spark.executor.instances=5 \
    --conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \
    --conf spark.kubernetes.container.image.pullPolicy=Always \
    --conf spark.kubernetes.container.image=merrily01/repo:spark-2.4.3-image-merrily01 \
    local:///opt/spark/examples/jars/spark-examples_2.11-2.4.3.jar

client模式:

spark-submit \
--master k8s://https://172.16.192.128:6443 \
--deploy-mode client  \
--name spark-pi \
--class org.apache.spark.examples.SparkPi  \
--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \
--conf spark.kubernetes.container.image.pullPolicy=Always \
--conf spark.kubernetes.container.image=merrily01/repo:spark-2.4.3-image-merrily01 \
/data0/spark/spark-2.4.3-bin-hadoop2.7/examples/jars/spark-examples_2.11-2.4.3.jar

2. 如果不知道--master 的api server地址,可通过命令:kubectl config view  查看;

3. 注意cluster方式,example.jar包位置:     local:///opt/spark/examples/jars/spark-examples_2.11-2.4.3.jar

 

 

你可能感兴趣的:(随手记,Spark,On,Kubernetes)