Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-24353][K8S][2.4] Support for specifying multiple custom tolerations to driver and executor pods #26505

Closed
wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 13, 2019

What changes were proposed in this pull request?

The PR allows a user to specify custom k8s tolerations when running Spark on kubernetes for both driver and executor pods.

The user can now set the key, effect, operator and value properties when running spark-submit, as long as they're prefixed by:

spark.kubernetes.driver.tolerations.n or spark.kubernetes.executor.tolerations.n

where n = a number starting from 0 that is incremented of 1.

Why not using the key field, as per original design doc attached to the JIRA issue?

As per kubernetes toleration v1 spec, the field key can be unset, thus disqualifying it as a unique identifier.

Some examples:

# driver pods tolerate the taint group:spark-driver registered to a specialised worker group
spark.kubernetes.driver.tolerations.0.key group
spark.kubernetes.driver.tolerations.0.operator Equal
spark.kubernetes.driver.tolerations.0.effect NoSchedule
spark.kubernetes.driver.tolerations.0.value spark-driver

# executor pods tolerate the taint group:spark-executor registered to another specialised worker group
spark.kubernetes.executor.tolerations.0.key group
spark.kubernetes.executor.tolerations.0.operator Equal
spark.kubernetes.executor.tolerations.0.effect NoSchedule
spark.kubernetes.executor.tolerations.0.value spark-executor

# driver pods tolerate when the key spot exists
spark.kubernetes.executor.tolerations.1.key spot
spark.kubernetes.executor.tolerations.1.operator Exists

Why are the changes needed?

Spark already supports using node selectors, which is helpful to pin driver/executor pods to a specific worker group. However, without tainting the workers and setting at least one toleration to the pods, the specialised worker group cannot ensure repelling non-spark pods, which could potentially lead to undesired, potentially unsuitable pods being scheduled in the specialised worker group.

This can be very important for many use cases, such as running spark jobs in AWS spot instances, which can be reclaimed at anytime by Amazon thus making it not suitable for every kind of workload.

Does this PR introduce any user-facing change?

No, it's a new feature.

How was this patch tested?

added both unit tests and k8s integration tests

…tions to driver and executor pods

The PR allows a user to specify custom [k8s tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) when running Spark on kubernetes for both driver and executor pods.

The user can now set the **key**, **effect**, **operator** and **value** properties when running spark-submit, as long as they're prefixed by:

`spark.kubernetes.driver.tolerations.n` or `spark.kubernetes.executor.tolerations.n`

where n = a number starting from 0 that is incremented of 1.

As per [kubernetes toleration v1 spec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#toleration-v1-core), the field key can be unset, thus disqualifying it as a unique identifier.

Some examples:

```
spark.kubernetes.driver.tolerations.0.key group
spark.kubernetes.driver.tolerations.0.operator Equal
spark.kubernetes.driver.tolerations.0.effect NoSchedule
spark.kubernetes.driver.tolerations.0.value spark-driver

spark.kubernetes.executor.tolerations.0.key group
spark.kubernetes.executor.tolerations.0.operator Equal
spark.kubernetes.executor.tolerations.0.effect NoSchedule
spark.kubernetes.executor.tolerations.0.value spark-executor

spark.kubernetes.executor.tolerations.1.key spot
spark.kubernetes.executor.tolerations.1.operator Exists
```

Spark already supports using [node selectors](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector), which is helpful to pin driver/executor pods to a specific worker group. However, without tainting the workers and setting at least one toleration to the pods, the specialised worker group cannot ensure repelling non-spark pods, which could potentially lead to undesired, potentially unsuitable pods being scheduled in the specialised worker group.

This can be very important for many use cases, such as running spark jobs in [AWS spot instances](https://aws.amazon.com/ec2/spot/), which can be reclaimed at anytime by Amazon thus making it not suitable for every kind of workload.

No, it's a new feature.

added both unit tests and k8s integration tests

Signed-off-by: Rafael Felix Correa <rafael.correa@olx.com>
@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@vanzin
Copy link
Contributor

vanzin commented Nov 15, 2019

  • All changes must be made first in the master branch.
  • You'll have to explain why pod templates don't cover this. All your feature step does is add stuff to the pod spec based on Spark config keys, which is what pod templates are supposed to cover (without the need for changing Spark code at all).

@ghost
Copy link
Author

ghost commented Nov 18, 2019

Hi @vanzin, thanks for taking the time.

About the pod templates feature, I can see documentation only in the master branch about it, but not in the 2.4 releases of spark. If 2.4 releases supports pod templates as well, I'm glad to try solving the issue without the code changes I proposed.

@vanzin
Copy link
Contributor

vanzin commented Nov 18, 2019

2.4 has already been released. We don't add new features to existing releases.

@ghost
Copy link
Author

ghost commented Nov 19, 2019

I can confirm the pod template feature works for setting tolerations to pods in spark 3.0.0-preview, thus making this PR unnecessary (unless you're planning a 2.5 release, but that's another discussion). Thanks @vanzin for pointing it out.

Documentation can be found here (for those like me, how struggled to find it): https://spark.apache.org/docs/3.0.0-preview/running-on-kubernetes.html#pod-template

@ghost ghost closed this Nov 19, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants