मुख्य विषयवस्तु में जाएं

Run Spark Submit (spark-submit) on Kubernetes

इलम में एक साधारण स्पार्क नौकरी मानक के माध्यम से प्रस्तुत की तरह ही संचालित होती है स्पार्क-सबमिट कमांड, लेकिन उपयोग में आसानी, कॉन्फ़िगरेशन और बाहरी उपकरणों के साथ एकीकरण के लिए अतिरिक्त संवर्द्धन के साथ।

आप अपने स्थानीय स्पार्क इंस्टॉलेशन या आपके पास मौजूद किसी भी कस्टम जार से स्पार्क उदाहरणों के साथ जेएआर फ़ाइल का उपयोग कर सकते हैं।

नीचे एक साधारण स्पार्क नौकरी का उपयोग करने और चलाने के लिए चरण-दर-चरण मार्गदर्शिका दी गई है स्पार्क-सबमिट on Ilum. This guide demonstrates the core configuration needed and shows how to monitor your job’s progress within the Ilum platform. For a complete overview of Ilum's architecture, check the Architecture Overview.


Quick Start (TL;DR)

How do I run a Spark job on Kubernetes with स्पार्क-सबमिट?

To run a Spark job on Ilum (Kubernetes), ensure Java 17 and Spark are installed, upload your JAR, and run:

Quick Start: Spark Submit on K8s
./bin/spark-submit \
--गुरू k8s://http://<ilum-core-address>:<ilum-core-port> \
--deploy-mode क्लस्टर \
--कक्षा org.apache.spark.examples.SparkPi \
--conf spark.driver.memory=4g \
--conf spark.ilum.cluster=चूक \
--conf स्पार्क.कुबेरनेट्स.कंटेनर.इमेज=ilum/spark:4.1.2 \
--conf spark.kubernetes.submission.waitAppCompletion=सच्चा \
s3a://ilum-files/ilum/default/spark-examples_2.13-4.1.2.jar

Note: Replace with your actual Ilum Core endpoint.

Step-by-Step Guide

1. Prerequisites

  • सुनिश्चित करें कि जावा 17 स्थापित है और आपके में सही ढंग से सेट है JAVA_HOME.
  • Download and extract the appropriate version of Apache Spark:
Download Spark 4
wget https://archive.apache.org/dist/spark/spark-4.1.2/spark-4.1.2-bin-hadoop3.tgz
tar -xzf spark-4.1.2-bin-hadoop3.tgz
cd spark-4.1.2-bin-hadoop3

2. Connect to Ilum

If Ilum is deployed on Kubernetes, forward the service port to your local machine to make Ilum accessible at लोकलहोस्ट:9888.

Forward Core
kubectl port-forward svc/ilum-core 9888:9888
Production Tip

यदि आप एक ही कुबेरनेट्स क्लस्टर के भीतर से संचार कर रहे हैं, तो आप कुबेरनेट्स डीएनएस-आधारित सेवा पते का उपयोग कर सकते हैं (जैसे, http://ilum-core.namespace.svc.cluster.local) or expose services using Ingress.

3. Submit Your Spark Job

Choose the submission method that best fits your workflow:

This method is suitable for quick local testing.

1. Upload your JAR File

For demonstration, we assume the JAR is uploaded manually to MinIO.

Locate the example JAR: examples/jars/spark-examples_2.13-4.1.2.jar

Upload it to MinIO (bucket इलम फ़ाइलें, path ilum/default/): s3a://ilum-files/ilum/default/spark-examples_2.13-4.1.2.jar

2. Submit via REST

Limitation

स्पार्क.ilum.pyआवश्यकताएँ is not supported in this mode, as REST does not support PySpark submissions.

Run the following command:

REST Submit (Spark 4)
./bin/spark-submit \
--गुरू spark://localhost:9888 \
--deploy-mode क्लस्टर \
--कक्षा org.apache.spark.examples.SparkPi \
--conf spark.master.rest.enabled=सच्चा \
--conf spark.ilum.cluster=चूक \
--conf spark.app.name=my-spark-job \
s3a://ilum-files/ilum/default/spark-examples_2.13-4.1.2.jar

Parameters:

Parameterया क़िस्‍म
--गुरूIlum Core address via REST (e.g. spark://localhost:9888).
--conf spark.master.rest.enabled=trueEnables REST submission.
s3a/...JAR file path in MinIO.
Expected Output
REST एप्लिकेशन सबमिशन प्रोटोकॉल का उपयोग करके स्पार्क चलाना।
25/03/12 12:58:01 जानकारी RestSubmissionClient: spark://localhost:9888 में एक आवेदन शुरू करने के लिए एक अनुरोध सबमिट करना।
25/03/12 12:58:03 जानकारी RestSubmissionClient: सबमिशन सफलतापूर्वक 20250312-1158-qdnioef2rny के रूप में बनाया गया। मतदान प्रस्तुत करने की स्थिति...
25/03/12 12:58:03 जानकारी RestSubmissionClient: spark://localhost:9888 में सबमिशन 20250312-1158-qdnioef2rny की स्थिति के लिए अनुरोध सबमिट करना।
25/03/12 12:58:03 जानकारी RestSubmissionClient: ड्राइवर की स्थिति 20250312-1158-qdnioef2rny अब सबमिट किया गया है।
25/03/12 12:58:03 जानकारी RestSubmissionClient: ड्राइवर ILUM_UI_ADDRESS/workloads/details/job/20250312-1158-qdnioef2rny पर वर्कर ILUM पर चल रहा है।
25/03/12 12:58:03 जानकारी RestSubmissionClient: सर्वर CreateSubmissionResponse के साथ प्रतिसाद:
{
"कार्रवाई": "CreateSubmissionResponse",
"serverSparkVersion" : "4.1.2",
"सबमिशन आईडी": "20250312-1158-qdnioef2rny",
"सफलता": सच
}
25/03/12 12:58:03 जानकारी ShutdownHookManager: शटडाउन हुक कहा जाता है
25/03/12 12:58:03 जानकारी शटडाउनहुक मैनेजर: निर्देशिका हटाना /tmp/spark-fa2603be-488a-4e2a-9b7f-5e49825d379b

4. Monitor and Troubleshoot

Using the Ilum UI:

  • नौकरी की प्रगति की निगरानी करें: Track executors, memory usage, and job stages.
  • Review Results: Access logs and the integrated Spark History Server.
  • Troubleshoot: Diagnose failures by checking detailed executor logs.

For more details on monitoring metrics, see the Monitoring Guide.


Comparison: Classic spark-submit vs Ilum Approach

Running Spark directly on Kubernetes requires significant administrative effort. Ilum simplifies this by automating infrastructure management.

Traditional Approach (Native Spark on K8s) vs Ilum

लक्षणNative Spark on K8sIlum (Managed Spark)
SetupManual Docker image build & complex स्पार्क-सबमिट args.Automated. Use existing JARs; Ilum handles images.
कॉन्फिगVerbose (Service Accounts, Volumes, Secrets).Simplified. Minimal args; configs are injected automatically.
भंडारManual Hadoop/S3 configuration per job.Integrated. Automatic credential injection for S3/GCS/Azure.
निगरानीCLI-based (kubectl logs), ephemeral.Centralized UI. Persistent logs, metrics, and history.
अवलोकन योग्यताBasic Spark UI (if exposed).अग्रवर्ती. डेटा वंश, detailed resource metrics.

Key Benefits of Ilum:

  1. Automatic Image Selection: Ilum selects a compatible Spark Docker image matching the cluster version.
  2. Advanced Observability: Ilum provides deep lineage observability and advanced monitoring capabilities.
  3. Simplified Configuration: Reduce स्पार्क-सबमिट parameters by 3x-4x.
  4. Integrated Storage Access: Credentials for all configured storages are automatically injected.
  5. Instant Monitoring: Logs and metrics (CPU/RAM) appear in the Ilum UI immediately.

For a developer, this means less time fighting with infrastructure and error-prone configurations, and more time delivering business logic.

For advanced customization, refer to the official Spark documentation.