[ 
https://issues.apache.org/jira/browse/SPARK-58748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chao Sun updated SPARK-58748:
-----------------------------
    Description: 
Spark Kubernetes client-mode drivers commonly bind RPC sockets to 0.0.0.0 or an 
IPv6 wildcard while advertising a routable address through spark.driver.host. 
When spark.kubernetes.executor.useDriverPodIP=true, SparkContext replaces 
spark.driver.host with spark.driver.bindAddress, and BasicExecutorFeatureStep 
independently uses that bind address to construct SPARK_DRIVER_URL. This 
produces executor URLs such as spark://[email protected]:7078, so 
executors cannot register with the driver.

The option was introduced in Spark 4.1 and is enabled by default in Spark 4.3 
and current master, making client-mode and Spark Connect drivers vulnerable 
without explicitly enabling the setting.

Reproduction: launch a Kubernetes client-mode driver with 
spark.driver.bindAddress=0.0.0.0, spark.driver.host set to a routable driver 
address, and spark.kubernetes.executor.useDriverPodIP=true. Observe executor 
connection failures against 0.0.0.0.

Expected: preserve the advertised spark.driver.host whenever 
spark.driver.bindAddress is an IPv4 or IPv6 wildcard; continue using and 
normalizing concrete driver Pod IPs. Both SparkContext and executor driver URL 
construction need the same wildcard guard.

Affected versions: 4.1.x and 4.2.x when explicitly enabled; 4.3.0 and 5.0.0 by 
default. Prioritize a 4.3 backport.

  was:SPARK-53944 added {{spark.kubernetes.executor.useDriverPodIP}} to let 
Kubernetes executors connect directly to the driver Pod IP. SPARK-57350 enabled 
this behavior by default in Spark 4.3.\n\nSome valid Kubernetes deployments, 
including Spark Connect servers and other client-mode drivers, bind their RPC 
server to all local interfaces while explicitly advertising a separate routable 
driver 
address:\n\n{code}\nspark.master=k8s://https://kubernetes.example:6443\nspark.driver.bindAddress=0.0.0.0\nspark.driver.host=10.129.36.37\nspark.kubernetes.executor.useDriverPodIP=true\n{code}\n\nBoth
 {{SparkContext}} and {{BasicExecutorFeatureStep}} currently substitute 
{{spark.driver.bindAddress}} for the advertised {{spark.driver.host}} when 
{{useDriverPodIP}} is enabled. This overwrites the routable advertised address 
with {{0.0.0.0}} and constructs executor RPC URLs such 
as:\n\n{code}\nspark://[email protected]:7078\n{code}\n\nExecutors 
cannot register with that unspecified address, so they repeatedly fail and the 
application cannot make progress. The same problem applies to IPv6 wildcard 
forms such as {{::}}, {{[::]}}, and {{0:0:0:0:0:0:0:0}}.\n\nSpark already 
documents {{spark.driver.bindAddress}} and {{spark.driver.host}} as separate 
bind and advertised addresses. The driver Pod IP optimization should continue 
to use concrete IPv4 and IPv6 bind addresses, including the IPv6 normalization 
fixed by SPARK-58719, but should preserve the configured advertised driver host 
whenever the bind address is an unspecified/wildcard address. Both driver 
address selection sites must agree.\n\nSpark 4.3 is affected by default; Spark 
4.1 and 4.2 are affected when users explicitly enable the option.


> Preserve the advertised driver host when the Kubernetes driver bind address 
> is a wildcard
> -----------------------------------------------------------------------------------------
>
>                 Key: SPARK-58748
>                 URL: https://issues.apache.org/jira/browse/SPARK-58748
>             Project: Spark
>          Issue Type: Bug
>          Components: Connect, Kubernetes, Spark Core
>    Affects Versions: 4.1.0, 4.2.0, 4.3.0, 5.0.0
>            Reporter: Chao Sun
>            Assignee: Chao Sun
>            Priority: Major
>             Fix For: 4.3.0, 5.0.0
>
>
> Spark Kubernetes client-mode drivers commonly bind RPC sockets to 0.0.0.0 or 
> an IPv6 wildcard while advertising a routable address through 
> spark.driver.host. When spark.kubernetes.executor.useDriverPodIP=true, 
> SparkContext replaces spark.driver.host with spark.driver.bindAddress, and 
> BasicExecutorFeatureStep independently uses that bind address to construct 
> SPARK_DRIVER_URL. This produces executor URLs such as 
> spark://[email protected]:7078, so executors cannot register 
> with the driver.
> The option was introduced in Spark 4.1 and is enabled by default in Spark 4.3 
> and current master, making client-mode and Spark Connect drivers vulnerable 
> without explicitly enabling the setting.
> Reproduction: launch a Kubernetes client-mode driver with 
> spark.driver.bindAddress=0.0.0.0, spark.driver.host set to a routable driver 
> address, and spark.kubernetes.executor.useDriverPodIP=true. Observe executor 
> connection failures against 0.0.0.0.
> Expected: preserve the advertised spark.driver.host whenever 
> spark.driver.bindAddress is an IPv4 or IPv6 wildcard; continue using and 
> normalizing concrete driver Pod IPs. Both SparkContext and executor driver 
> URL construction need the same wildcard guard.
> Affected versions: 4.1.x and 4.2.x when explicitly enabled; 4.3.0 and 5.0.0 
> by default. Prioritize a 4.3 backport.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to