Spark-on-k8s-operator: How to pass in application arguments in yaml file?

Created on 25 Jan 2019  路  9Comments  路  Source: GoogleCloudPlatform/spark-on-k8s-operator

Using spark-submit, I can pass in application-arguments at the end:

./bin/spark-submit \
  --class <main-class> \
  --master <master-url> \
  --deploy-mode <deploy-mode> \
  --conf <key>=<value> \
  ... # other options
  <application-jar> \
  [application-arguments]

I am wondering what's the syntax of passing in these application-arguments in yaml files?

Thanks.

Most helpful comment

--kafka-bootstrap-server: my-kafka:9092
--kafka-input-topic topicA
--kafka-output-topic topicB

All 9 comments

spec:
    arguments:
    - arg1
    - arg2

@liyinan926 thanks. For instance, if my application-arguments is:

 --kafka-bootstrap-servers kafka:9092

in the spark-submit command. What's the best way to convert it to the arguments section? Like this?

spec:
    arguments:
    - --kafka-bootstrap-servers
    - kafka:9092

BTW, looks like it doesn't support multiple args. When I use:

- --kafka-bootstrap-servers kafka:9092 
- --kafka-input-topic
- output
- --kafka-output-topic
- output2

I saw the driver pod failed to start up. And the command it converted to is:

exec /sbin/tini -s -- /opt/spark/bin/spark-submit --conf spark.driver.bindAddress=<IP> --deploy-mode client --properties-file /opt/spark/conf/spark.properties --class <className> spark-internal --kafka-bootstrap-servers 'kafka:9092 - --kafka-input-topic - output - --kafka-output-topic - output2'

So what's the correct way to use multiple arguments in the yaml file? Thanks!

Now it works. Please close the issue.

How did you fix this issue.. @goplusgo
Thanks!!

In my case I needed to use "--" in front of the application arguments (long form) instead of "-" (short form) and I couldn't use the short form for some reason

Can i get example for that...? @kyprifog
Thanks!!

--kafka-bootstrap-server: my-kafka:9092
--kafka-input-topic topicA
--kafka-output-topic topicB

I've landed here with randomness googling because it was exactly what I needed, but I think this is missing in the documentation.
An integration in the docs would be greatly appreciated, if not on the older versions at least on the current stable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jemega picture jemega  路  8Comments

AceHack picture AceHack  路  6Comments

liyinan926 picture liyinan926  路  3Comments

fisache picture fisache  路  6Comments

leandro-rouberte picture leandro-rouberte  路  4Comments