kubeflow / spark-operator

Kubernetes operator for managing the lifecycle of Apache Spark applications on Kubernetes.
Apache License 2.0
2.77k stars 1.38k forks source link

Move away from the webhook for driver/executor pod configurations #1176

Open liyinan926 opened 3 years ago

liyinan926 commented 3 years ago

Given a number of occurrences of issues with the webhook that stops working after some time due to certificate issues, I'm thinking that the right direction in the long term is to move away from it. For anyone who's already on Spark 3.0, the pod template support for driver/executor pods may be the right way to go. The operator should be able to translate driver and executor configs in SparkApplications into driver and executor pod templates and use the templates when submitting applications. Creating this issue to track the work.

suvashishtha commented 3 years ago

@liyinan926 - Do you have an example somewhere how to use podtemplate in sparkapplication. would be really cool. thanks

dszakallas commented 3 years ago

Hi, I started working on this issue, and came up with a minimal working implementation in https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/pull/1296

My approach is to put a template property in SparkPodSpec, and serialize its contents to a temporary file before the call to spark-submit, passing the file names in their respective spark.kubernetes.driver.podTemplateFile and spark.kubernetes.executor.podTemplateFile conf options. The files can be cleaned up immediately after spark-submit, as it creates the required Kubernetes resources - (1) the driver pod that has the template applied to, and a (2) configmap storing the executor template for later use by the driver, - synchronously.

https://spark.apache.org/docs/latest/running-on-kubernetes.html#pod-template

I didn't include the regenerated CRDs in the PR. Further items to decide before moving forward:

dszakallas commented 3 years ago

@liyinan926 could you take a look?

elihschiff commented 2 years ago

Do you have an example somewhere how to use podtemplate in sparkapplication. would be really cool. thanks

For anyone else who stumbles upon this issue, here is how I was able to do it:

  1. Create a configmap for your pod template
  2. Mount that configmap to the operator pod
  3. Use the sparkConf setting on your SparkApplication to set the template file. Something like
    sparkConf:
    spark.kubernetes.driver.podTemplateFile: "/etc/templates/pod_template.yaml"
ahuret commented 2 years ago

Hello :wave: We also experimented issues with webhook, it stops working sometimes. What about this enhancement ? Any news ? Thank you :-)

gaurav-uptycs commented 1 year ago

Hello Facing this same issue when using webhook. NodeAffinity is not being parsed in SparkApplication . Also webhook even though is deployed looks like the k8s cluster is not able to access it. Please let me know if any of you know a way to bypass this. Thanks .

bscaleb commented 7 months ago

@elihschiff does the spark-operator helm chart have any support for mounting a configmap to the operator pod? I don't see anything in the values or documentation. I definitely don't want to have to be manually editing the deployment in k8s.

elihschiff commented 7 months ago

Sorry this was 2 years ago, I don't remember exactly what I did. But I wouldn't be surprised if I had modified the helm chart to get it working

github-actions[bot] commented 1 week ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.