An Apache Spark deploy mode decides where the driver process runs. In local mode the driver and executor share one JVM on one machine. In client mode, the spark-submit default, the driver runs on the submitting machine while executors run on the cluster. In cluster mode the cluster manager launches the driver inside the cluster.
Last updated October 2026.
Local mode for a laptop, unit tests and CI. Client mode for shells, notebooks and anything where you read output in your console. Cluster mode for scheduled production jobs, where the machine that submitted the job may go away. The application code is identical in all three; only the launch settings change.
Every Spark application has a driver (holds the SparkSession, plans the job, schedules tasks, receives results such as collect()), executors (run the tasks, hold cached data, and must reach the driver for the whole run) and a cluster manager (Standalone, YARN or Kubernetes, named by --master). The deploy mode answers one question: where does the driver run? To choose, ask what happens if the submitting machine goes away.
spark-submit --master "local[*]" etl_job.py
# or in code
spark = SparkSession.builder.master("local[4]").getOrCreate()
The driver and the executor run in a single JVM on one machine, and tasks run on threads: local is one thread, local[4] four, local[*] one per logical core. There is no cluster manager and nothing to provision, which makes it right for development, unit tests and small samples. The ceiling is one machine's memory and cores. Strictly, local is a --master value rather than a --deploy-mode value, but the exam guide lists it alongside client and cluster.
spark-submit --master yarn --deploy-mode client etl_job.py
The driver runs inside the spark-submit process on the submitting machine, and the executors run on the cluster. Leave out --deploy-mode and this is what you get.
The catch: the submitting machine must stay up and connected for the whole run. If it sleeps or loses the network, the driver dies and the application with it. Submit from a gateway machine close to the workers, not across a VPN.
spark-submit --master yarn --deploy-mode cluster etl_job.py
The cluster manager launches the driver on a node inside the cluster (a YARN container, a Kubernetes driver pod), next to its executors. The submitter can disconnect once the job is accepted, and the driver talks to executors over the cluster's own network instead of across a VPN. The cost is visibility: there is no console, so output and driver logs live in the Spark UI and the cluster manager's logs.
| local | client | cluster | |
|---|---|---|---|
| Driver runs on | Your machine | The submitting machine | A cluster node |
| Executors run on | Same JVM, as threads | The cluster | The cluster |
| Submitter can disconnect | No | No | Yes |
| Selected by | --master local[*] | Default, or --deploy-mode client | --deploy-mode cluster |
| Typical use | Dev, tests, CI | Shells, notebooks | Production jobs |
Sourced from the Submitting Applications and Cluster Mode Overview pages of the Apache Spark documentation.
The pyspark shell and notebooks need their driver attached to the console, so they run in client mode, and cluster deploy mode is not available to shells at all. On a gateway node the driver sits on the gateway while the heavy work still runs on the cluster's executors.
One restriction the exam likes: on a Standalone cluster, Python applications cannot use cluster mode. The documented options are client mode from a gateway, or YARN or Kubernetes when the driver must live inside the cluster.
Deploy modes describe classic Spark, where your application is the driver. Spark Connect splits them: a thin client builds an unresolved logical plan and sends it over gRPC to a Spark Connect server, which analyzes and runs it. The driver lives with the server, on the cluster side, while the client can be a laptop IDE.
from pyspark.sql import SparkSession
spark = SparkSession.builder.remote("sc://host:15002").getOrCreate()
The pyspark-client package is pure Python with no JVM, a client crash takes down only its own process, and --deploy-mode, a classic spark-submit setting, does not apply. The trade: Connect clients have no RDD API and no SparkContext, so code that needs them stays in classic mode. Spark 4.0 adds spark.api.mode (classic or connect) to switch an application between the two.
Deployment modes and Spark Connect together form "Using Spark Connect to Deploy Applications", 5% of the Databricks Certified Associate Developer for Apache Spark exam in the official guide. These signals cover it:
Exam tip: a job launched with spark-submit --master yarn etl_job.py from a CI runner that shuts down fails partway through because the default is client mode and the driver dies with the runner. Adding --deploy-mode client changes nothing; --deploy-mode cluster fixes it.
Client mode is the default. If spark-submit runs without --deploy-mode, the driver runs inside the spark-submit process on the submitting machine and only the executors run on the cluster.
The difference is where the driver runs. In client mode the driver runs on the machine that submitted the application, which must stay connected; in cluster mode the cluster manager launches the driver on a node inside the cluster, so the submitter can disconnect.
Local mode runs the driver and the executor in a single JVM on one machine, with tasks on threads, set with --master local, local[4] or local[*]. It needs no cluster manager and suits development, unit tests and small samples.
No. Spark's Standalone cluster manager does not support cluster deploy mode for Python applications. Use client mode from a gateway machine, or run on YARN or Kubernetes when the driver must live inside the cluster.
Neither, in the classic sense. With Spark Connect the driver runs with the Spark Connect server and a thin client sends it unresolved logical plans over gRPC, so --deploy-mode, a classic spark-submit setting, does not apply to the client.
Deployment modes are a trade-off chapter in the Spark Developer Associate course, next to a chapter on Spark Connect, with the side-by-side table built step by step and quiz cards on the CI-runner and gateway-shell scenarios.
Open the chapter →