The full answer
The deploy mode decides where the driver runs. In client mode the driver runs inside the process that started the application, such as spark-submit on an edge node, a notebook or your laptop. In cluster mode the cluster manager starts the driver on a machine inside the cluster, and spark-submit can exit once the application is launched.
spark-submit --master yarn --deploy-mode client job.py # driver on this machine
spark-submit --master yarn --deploy-mode cluster job.py # driver in a YARN container
| Client mode | Cluster mode | |
|---|---|---|
| Driver location | The submitting machine | A node in the cluster |
| Output and logs of the driver | The console where you submitted | The cluster's logs |
| If the submitting machine disconnects | The application dies | The application keeps running |
| Network between driver and executors | May be slow if the client is far away | Local to the cluster |
| Interactive use (shells, notebooks) | Yes | No |
| Typical use | Development, debugging, notebooks, interactive shells | Production jobs and schedulers |
Client mode in more detail
- The driver's resources are the client machine's; a large
collect()or broadcast can exhaust a small edge node. - Executors must be able to connect back to the client, which matters with firewalls and in Kubernetes.
- Good for seeing output immediately and for interactive tools such as
pysparkand notebooks.
Cluster mode in more detail
- The driver gets resources from the cluster (
--driver-memory,--driver-cores) and fails over with the cluster manager's support (for example YARN application attempts). - Logs must be collected from the cluster (
yarn logs -applicationId ..., or driver pod logs in Kubernetes). - Application files and dependencies must be reachable from the cluster (uploaded with
--py-files,--filesor--archives, or in shared storage).
Cluster manager specifics
- YARN: in cluster mode the driver runs in the application master container.
- Kubernetes: cluster mode creates a driver pod, which creates executor pods; client mode needs the driver to be reachable from the pods.
- Standalone: cluster mode isn't supported for Python applications, so PySpark jobs on standalone clusters run in client mode.
- Local (
--master local[*]): everything runs in one process; deploy mode doesn't apply.
Managed platforms On Databricks, EMR Serverless or Dataproc Serverless you don't choose: the platform runs the driver for you, and notebooks connect to it, effectively client-style interaction with cluster-side drivers.
How I choose Client mode for exploration and debugging close to the cluster; cluster mode for scheduled production jobs, so they don't depend on the submitting machine staying up.
Last updated 16 October 2026
Sources