What's the most elegant/right way to stop a spark job running on a Kubernetes cluster?

11/19/2019

I'm new to apache spark and I'm trying to run a spark job using spark-submit on my Kubernetes cluster. I was wondering if there's a right way to stop spark jobs once the driver and executor pods are spawned? Would deleting the pods themselves be enough?

Thanks!

-- Joshua Villanueva
apache-spark
kubernetes

3 Answers

11/19/2019

When you will delete executor it will be recreated again and spark application will work. However if you will delete driver pod it will stop application.

So killing driver pod is actually the way to stop the Spark Application during the execution.

As you are new to Spark and you want to run it on Kubernetes, you should check this tutorial.

-- PjoterS
Source: StackOverflow

11/19/2019

At present the only way to stop Spark job running on Kuberentes is to delete the Driver Pod (unless you have an app controlling Spark context which is able to manipulate it). Since all other job-related resources are linked to Spark Driver Pod with such as called ownerReferences, they will be removed automatically by Kubernetes.

-- Aliaksandr Sasnouskikh
Source: StackOverflow

11/19/2019

It should clean things up when the job completes automatically.

-- coderanger
Source: StackOverflow