Commit dd8d13b
committed
[SPARK-53944][K8S] Support
### What changes were proposed in this pull request?
This PR aims to support `Spark Executor` pod to use `Spark Driver` pod IP instead of `Spark Driver`'s K8s Service in order to bypass K8s DNS issues.
### Why are the changes needed?
K8s DNS has a known issue and an official workaround via `initContainer` solution because it assumes IP can be changed during restarting the pods.
- https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#init-containers-in-use
This (SPARK-53944) provides an additional option for users to choose IP over DNS in K8s environment instead of `initContainer` workaround because Apache Spark Driver is not supposed to be restarted in general. When a Spark Driver pod terminates for some reason, it's more natural to terminate all its executor pods and restart the whole Spark job from the beginning.
Since `Driver` Pod IP is automatically injected via `SPARK_DRIVER_BIND_ADDRESS`, this PR re-use it.
https://github.com/apache/spark/blob/8499a62fb6b1ee51f82e65c4e449ec2eae6a0cc2/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicDriverFeatureStep.scala#L131-L133
https://github.com/apache/spark/blob/8499a62fb6b1ee51f82e65c4e449ec2eae6a0cc2/resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh#L82-L86
### Does this PR introduce _any_ user-facing change?
No, this is disabled by default.
### How was this patch tested?
Pass the CI with newly added test case.
I also verified manually.
**spark.kubernetes.executor.useDriverPodIP=false**
```
... --driver-url spark://CoarseGrainedSchedulerpi-0-driver-svc.default.svc:7078 ...
```
**spark.kubernetes.executor.useDriverPodIP=true**
```
... --driver-url spark://CoarseGrainedScheduler10.1.20.97:7078 ...
```
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #52650 from dongjoon-hyun/SPARK-53944.
Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>spark.kubernetes.executor.useDriverPodIP
1 parent 2c7bc89 commit dd8d13b
File tree
3 files changed
+27
-1
lines changed- resource-managers/kubernetes/core/src
- main/scala/org/apache/spark/deploy/k8s
- features
- test/scala/org/apache/spark/deploy/k8s/features
3 files changed
+27
-1
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
52 | 57 | | |
53 | | - | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
308 | 322 | | |
309 | 323 | | |
310 | 324 | | |
| |||
0 commit comments