Spark master IP on Kubernetes

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Spark master IP on Kubernetes

This post has NOT been accepted by the mailing list yet.
We are deploying Spark on k8s cluster. We are facing one issue with respect to Spark master IP from a worker perspective. The Spark master is exposed as a service @

Spark worker registers with the master, but saves the pod IP, instead of the service IP.

Following are related logs.
17/03/18 03:33:15 SPARK_WORKER INFO Utils: Successfully started service 'WorkerUI' on port 8081.
17/03/18 03:33:15 SPARK_WORKER INFO WorkerWebUI: Bound WorkerWebUI to, and started at
17/03/18 03:33:15 SPARK_WORKER INFO Worker: Connecting to master
17/03/18 03:33:15 SPARK_WORKER INFO ContextHandler: Started o.s.j.s.ServletContextHandler@1302ede4{/metrics/json,null,AVAILABLE}
17/03/18 03:33:15 SPARK_WORKER INFO TransportClientFactory: Successfully created connection to / after 89 ms (0 ms spent in bootstraps)
17/03/18 03:33:15 SPARK_WORKER INFO Worker: Successfully registered with master spark://

As can be seen, what gets registered is the pod IP - spark://

The issue due to this behavior is that when spark master pod dies or restarts, the spark worker does not act on the disconnected message, since it checks if the disconnected IP (here, we get service IP - matches with the locally stored IP (in this case, it is

Any suggestions how I can override this behavior, without changing spark code?

If this can be achieved only by changing spark behavior, please share ideas how to go about.