shazebkhan1 opened a new pull request, #58283:
URL: https://github.com/apache/spark/pull/58283

   ### What changes were proposed in this pull request?
   
   Introduces a new config `spark.kubernetes.clusterDomain` (default: 
`cluster.local`) and changes
   the driver hostname constructed in `DriverServiceFeatureStep` from a partial 
DNS name to a
   fully-qualified domain name (FQDN) with a trailing dot:
   
   **Before:**
   ```
   <service>.<namespace>.svc
   ```
   
   **After:**
   ```
   <service>.<namespace>.svc.<clusterDomain>.
   ```
   
   The trailing dot tells the DNS resolver to treat the name as absolute, 
bypassing the pod's
   configured search domain list entirely.
   
   ### Why are the changes needed?
   
   When executors resolve `spark.driver.host`, the standard Kubernetes pod DNS 
configuration uses
   `ndots:5` with search domains:
   
   ```
   search <namespace>.svc.cluster.local svc.cluster.local cluster.local
   ```
   
   The existing partial hostname `<service>.<namespace>.svc` contains only 2 
dots, which is below
   the `ndots:5` threshold. The resolver therefore attempts to resolve it by 
appending each search
   domain in turn, producing two NXDOMAIN responses before arriving at the 
correct address:
   
   ```
   Attempt 1: <service>.<namespace>.svc.<namespace>.svc.cluster.local. → 
NXDOMAIN
   Attempt 2: <service>.<namespace>.svc.svc.cluster.local.             → 
NXDOMAIN
   Attempt 3: <service>.<namespace>.svc.cluster.local.                 → NOERROR
   ```
   
   In production environments running many concurrent Spark pipelines, each 
executor startup
   generates these spurious failed lookups. This adds unnecessary NXDOMAIN 
traffic to CoreDNS
   (a shared cluster-wide component) and can contribute to delays during 
executor-to-driver
   connection establishment.
   
   Using a trailing-dot FQDN forces the resolver to issue a single absolute 
lookup, eliminating
   all NXDOMAIN responses. The new `spark.kubernetes.clusterDomain` config 
accommodates clusters
   that use a non-default domain (i.e., something other than `cluster.local`).
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `spark.driver.host` is now set to 
`<service>.<namespace>.svc.cluster.local.` by default
   instead of `<service>.<namespace>.svc`. This is backward compatible for 
standard clusters.
   Users on clusters with a non-default domain can configure 
`spark.kubernetes.clusterDomain`.
   
   ### How was this patch tested?
   
   The fix was validated by manually patching the jar and testing it in a local 
Kubernetes
   development environment. The following scenarios were verified:
   
   - Tested with the default `cluster.local` domain.
   - Tested with a custom cluster DNS domain.
   - Verified the resulting driver hostname is a trailing-dot FQDN.
   - Confirmed that executor-to-driver connections succeed without any NXDOMAIN 
lookups in CoreDNS.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to