تخطي إلى المحتوى الرئيسي

Air-Gapped Installation of Apache Spark on Kubernetes

يوجد أدناه دليل خطوة بخطوة للتثبيت إيلوم في بيئة غير متصلة بالإنترنت (بفجوات هوائية). تمت كتابة هذا الدليل ليكون محايدا لتوزيع Kubernetes الخاص بك ويغطي كلا النهجين لإدارة صور الحاوية - باستخدام حاويات (مع السمة الخطر أدا) أو عامل الإرساء . تفترض التعليمات أن لديك:

  • محطة عمل متصلة بالإنترنت لتنزيل مخطط Helm المطلوب وصور الحاوية.
  • طريقة (مثل محرك أقراص USB أو خادم ملفات داخلي) لنقل الملفات من محطة العمل عبر الإنترنت إلى بيئتك غير المتصلة بالإنترنت.
  • مجموعة Kubernetes عاملة (أي توزيع) في بيئتك غير المتصلة.
  • تم تثبيت Helm وتكوينه للاتصال بنظام المجموعة غير المتصل.
  • Sufficient Disk Space: At least 60GB free on both the download and offline machines (for handling large image tarballs).
  • Recommended Resources: 12 CPU and 18GB RAM (or more depending on workload).

Architecture Overview: Spark on Kubernetes in Air-Gapped Environments

When deploying Apache Spark on Kubernetes in an air-gapped environment, the driver and executor processes run as containerized processes 100% managed within infrastructure devoid of public connectivity. All container images and dependencies, along with configuration files, are hosted internally and do not need external network access.

In this environment, we deploy Spark components as containerized applications on Kubernetes. Spark driver and executors operate as pods. Scheduling, resource allocation, and scaling are handled by Kubernetes. The setup uses native Kubernetes features like resource limits, Horizontal Pod Autoscaling, and node selectors for smooth and reliable functioning. For general details on how Ilum manages these resources, see the Architecture Overview.

A local image registry is a key part of this architecture. Instead of manually loading images on every node, you push them into a registry within your infrastructure. Whether using a basic deployment with السجل:2 or a robust solution like Harbor, the registry must be backed by persistent storage to retain images after restarts. Once images are in the registry, individual nodes can pull them on demand.

Networking and security are critical. Air-gapped environments use network policies to control pod communication. These policies limit interactions to necessary components using Kubernetes' security controls (RBAC, service accounts), ensuring compliance with strict no-ingress rules.

This structure supports complex jobs including Spark Core, Spark SQL, Spark Streaming, and MLlib applications. Integrated with tools like كوبيكتل , Helm, Prometheus, and Grafana, this setup makes deployment, monitoring, and debugging efficient even without internet access. You can run jobs via واجهة برمجة تطبيقات REST أو Spark Submit once the cluster is operational.


1. Preparation and Downloads

يتم تقسيم العملية إلى الخطوات التالية:

1.1. Download Ilum Helm Chart for Offline Use

يتم توفير مخطط Ilum عبر مستودع Helm عام ، قم بتشغيله:

Helm Setup
خوذة الريبو إضافة ILUM https://charts.ilum.cloud 
تحديث Helm Repo
Helm Pull ilum / ilum # (يمكنك إضافة --version <desired_version> لتحديد إصدار ilum)

سيؤدي هذا إلى إنشاء ملف ilum-<version>.tgz .

بقشيش: يمكنك استخراج وتعديل الرسم البياني القيم.yaml لاحقا إذا كنت تريد تغيير مراجع مستودع الصور.

1.2. Identify and Download Required Docker Images

Below is the list of images(version 6.6.1 of ilum):

Click to view required images list
  • alpine/kubectl:1.34.1
  • apache/airflow:3.0.2
  • apache/nifi:2.5.0
  • أباتشي / مجموعة فائقة: dockerize
  • bitnamilegacy/postgresql:16
  • bitnami/git:latest
  • curlimages / حليقة: 8.5.0
  • docker.io/bitnamilegacy/minio:2025.3.12-debian-12-r0
  • docker.io/bitnamilegacy/os-shell:11-debian-11-r72
  • docker.io/bitnamilegacy/postgresql:16.1.0-debian-11-r25
  • docker.io/bitnamilegacy/redis:7.0.10-debian-11-r4
  • docker.io/ilum/mongodb:6.0.5
  • ghcr.io/projectnessie/nessie:0.105.1
  • جيتيا / جيتا: 1.22.3
  • ilum/airflow:3.1.1
  • ilum/core:6.6.1
  • ilum / خلية النحل: 3.1.3
  • ILUM / كيوبي: 1.10.0-شرارة
  • ilum/mageai:0.9.76
  • ILUM / Mongodb: 6.0.5
  • ilum/spark:3.5.7-delta
  • ILUM / شرارة قاذفة: سبارك -3.5.3
  • ilum/sparkmagic:0.23.3
  • ilum/streamlit-example:1.0.0
  • ilum/superset:4.1.0.1
  • ilum/ui:6.6.1
  • jpgouin/openldap:2.6.9-fix
  • minio/mc:RELEASE.2025-04-16T18-13-26Z
  • registry.k8s.io/git-sync/git-sync:v4.3.0
  • trinodb/trino:477

1.3 احفظ كل صورة ككرة تاربول

يمكنك كتابة هذه العملية. على سبيل المثال، قم بإنشاء ملف باسم pull_and_save.sh :

pull_and_save.sh
#!/بن / باش 
الصور =(
"alpine/kubectl:1.34.1"
"apache/airflow:3.0.2"
"apache/nifi:2.5.0"
"أباتشي / مجموعة فائقة: dockerize"
"bitnamilegacy/postgresql:16"
"bitnami/git:latest"
"curlimages / curl: 8.5.0"
"docker.io/bitnamilegacy/minio:2025.3.12-debian-12-r0"
"docker.io/bitnamilegacy/os-shell:11-debian-11-r72"
"docker.io/bitnamilegacy/postgresql:16.1.0-debian-11-r25"
"docker.io/bitnamilegacy/redis:7.0.10-debian-11-r4"
"docker.io/ilum/mongodb:6.0.5"
"ghcr.io/projectnessie/nessie:0.105.1"
"جيتيا / جيتا: 1.22.3"
"ilum/airflow:3.1.1"
"ilum/core:6.6.1"
"ilum / خلية: 3.1.3"
"ILUM / Kyuubi: 1.10.0-spark"
"ilum/mageai:0.9.76"
"ILUM / Mongodb: 6.0.5"
"ilum/spark:3.5.7-delta"
"ILUM / Spark-Launcher: Spark-3.5.3"
"ilum/sparkmagic:0.23.3"
"ilum/streamlit-example:1.0.0"
"ilum/superset:4.1.0.1"
"ilum/ui:6.6.1"
"jpgouin/openldap:2.6.9-fix"
"minio/mc:RELEASE.2025-04-16T18-13-26Z"
"registry.k8s.io/git-sync/git-sync:v4.3.0"
"trinodb/trino:477"
)

للصورة في "${IMAGES[@]}"; فعل
صدى "سحب $image..."
عامل الإرساء سحب "$image"
اسم الملف = $ (صدى "$image" | tr '/:' '__')
echo "حفظ $image إلى ${filename}.tar..."
docker حفظ "$image" -o "${filename}.tar"
منجز

قم بتشغيل البرنامج النصي:

Execute Script
CHMOD + x pull_and_save.sh 
./pull_and_save.sh

ينتج عن هذا مجموعة من .قطران الملفات التي تحتوي على صورك.


2. نقل البيانات الاصطناعية إلى البيئة غير المتصلة بالإنترنت

استخدم طريقتك المفضلة (محرك أقراص USB وخادم ملفات داخلي و scp وما إلى ذلك) لنسخ ما يلي من جهازك عبر الإنترنت إلى البيئة غير المتصلة بالإنترنت:

  • حزمة مخطط Helm (على سبيل المثال ، ilum-<version>.tgz )
  • جميع كرات القطران للصور (على سبيل المثال ، apache_superset_dockerize.tar , ilum_hive_3.1.3.tar ، إلخ.)

3. Import Container Images (Docker & Containerd)

عند استخدام سجل محلي، يمكنك لا تحتاج لتحميل الصور يدويا على كل عقدة. بدلا من ذلك ، يمكنك دفعها إلى السجل المحلي الخاص بك ، وبعد ذلك ستقوم جميع العقد بسحب الصور من السجل حسب الحاجة. فيما يلي إرشادات لإعداد الصور قبل دفعها إلى السجل الخاص بك.

Managing Disk Space: If you are short on disk space, consider processing images sequentially (load one, push it, then delete the tarball) instead of copying all tarballs at once.

3A.1. استيراد صورة Tarballs (على جهاز واحد)

على جهاز يمكنه الوصول إلى السجل المحلي الخاص بك ، قم باستيراد tarball (s):

Import Image
sudo ctr -n k8s.io استيراد الصور /path/to/<image_tarball>.tar 

على سبيل المثال:

Import Hive Image
sudo CTR -n k8s.io استيراد الصور /opt/offline-images/ilum_hive_3.1.3.tar 

3أ.2. وضع علامة على الصورة في السجل المحلي

ضع علامة على الصورة باستخدام نقطة نهاية السجل المحلي (على سبيل المثال، إذا كان من الممكن الوصول إلى السجل الخاص بك على المضيف المحلي:5000 ):

Tag Image
sudo ctr -n k8s.io الصور علامة ILUM / Hive: 3.1.3 المضيف المحلي: 5000 / ILUM / Hive: 3.1.3 

3أ.3. دفع الصورة إلى السجل المحلي

ادفع الصورة التي تم وضع علامة عليها:

Push Image
sudo ctr -n k8s.io الصور push --plain-http localhost: 5000 / ilum / hive: 3.1.3 

(استخدم --عادي-http إذا تم تكوين السجل الخاص بك بدون TLS.)


4. Setup Local Image Registry (Preferred)

يوصى بشدة باستخدام سجل محلي لأنه يبسط إدارة الصور ويتوسع بشكل جيد للمجموعات الأكبر أو الديناميكية. على الرغم من أنه يمكنك تشغيل سجل أساسي باستخدام السجل:2 ، فكر في بدائل قوية مثل ميناء أو Nexus Repository Manager أو Quay. على سبيل المثال ميناء يوفر التحكم في الوصول المستند إلى الأدوار وفحص الثغرات الأمنية والنسخ المتماثل للصور وواجهة مستخدم ويب سهلة الاستخدام.

مهم: تأكد من تكوين أي سجل تختاره باستخدام وحدة تخزين ثابتة مرفقة (أو تخزين مستمر). يضمن ذلك بقاء صورك متاحة حتى إذا تمت إعادة تشغيل حاوية التسجيل أو تحديثها.

مثال: إعداد سجل أساسي باستخدام التخزين المستمر (Docker)

  1. إنشاء دليل لبيانات التسجيل:

    Create Directory
    mkdir -p /opt/registry-data 
  2. قم بتشغيل حاوية التسجيل باستخدام وحدة تخزين:

    Start Registry
    عامل الإرساء تشغيل -د \ 
    -ص 5000:5000 \
    --اسم السجل \
    -v / opt / registry-data: / var / lib / registry \
    السجل:2

مثال: استخدام الميناء

للحصول على حل أكثر قوة ، قم بتنزيل برنامج التثبيت دون اتصال بالإنترنت من Harbour من صفحة إصدارات Harbor GitHub واتبع الوثائق المقدمة. يتطلب منك Harbor تكوين التخزين المستمر (باستخدام وحدات التخزين) كجزء من تثبيته.


5. Configure Helm for Local Registry

لضمان ذلك إيلوم يسحب الصور من السجل المحلي بدلا من المستودعات العامة ، وقم بتحديث مراجع مستودع الصور في مخطط Helm. على سبيل المثال، إذا كانت القيم الافتراضية تحتوي على:

إيلوم كور : 
صورة : "ilum/core:6.6.1"

قم بتغييره إلى:

إيلوم كور : 
صورة : "localhost:5000/ilum/core:6.6.1"

يمكنك إما تعديل الرسم البياني الافتراضي القيم.yaml أو قم بتوفير ملف تجاوز. على سبيل المثال، إنشاء local-registry-values.yaml :

إيلوم كور : 
صورة : "localhost:5000/ilum/core:6.6.1"

ILUM-UI :
صورة : "localhost:5000/ilum/ui:6.6.1"

# إضافة تجاوزات مماثلة للمكونات الأخرى (على سبيل المثال ، ilum / air flow ، ilum / hive ، إلخ.)

ثم قم بتثبيت (أو ترقيتها) باستخدام:

Helm Install
قم بتثبيت ILUM /path/to/ILUM-<version>.tgz --namespace ilum --create-namespace -f local-registry-values.yaml 

6. تثبيت ilum باستخدام Helm

تأكد من أن kubeconfig لنظام المجموعة غير المتصل، ثم قم بتثبيت مخطط Helm:

Helm Install
Helm install ilum /path/to/ilum-<version>.tgz --namespace ilum --create-namespace 

(قم بتضمين ملف التجاوز إذا كنت تستخدم واحدا.)


7. التحقق واستكشاف الأخطاء وإصلاحها

7.1. التحقق من النشر

  • تحقق من حالة تحرير Helm:

    Helm Status
    حالة Helm ILUM --Namespace ilum 
  • قائمة الكبسولات:

    Get Pods
    kubectl الحصول على القرون -n ilum 
  • فحص مراجع صور الجراب:

    على سبيل المثال:

    Describe Pod
    kubectl وصف pod <pod_name> -n ilum | grep صورة: 

    تأكد من أن مسارات الصور تشير إلى السجل المحلي الخاص بك (على سبيل المثال، المضيف المحلي: 5000 / ILUM / الخلية: 3.1.3 ).

7.2. استكشاف الأخطاء وإصلاحها

Click to view troubleshooting steps
  • أخطاء ImagePullBackOff:
    تحقق من توفر الصور في السجل المحلي ومن أن جميع العقد يمكنها الوصول إلى السجل.
  • الوصول إلى السجل:
    تأكد من تكوين أي إعدادات تسجيل غير آمنة مطلوبة (في حالة استخدام HTTP) على العقد الخاصة بك.
  • التخزين المستمر:
    تأكد من تحميل دليل بيانات السجل المحلي بشكل صحيح بحيث تستمر الصور عبر إعادة تشغيل الحاوية.

Frequently Asked Questions (FAQ)

Can I run Apache Spark on Kubernetes without internet access?

Yes. By using an air-gapped installation method, all necessary dependencies (Docker images, Helm charts) are downloaded on an online machine, transferred to the offline environment, and hosted in a local registry.

Do I need a local image registry for air-gapped installation?

While you can technically load images manually onto every node using docker loadأو ctr image import, setting up a local registry (like Harbor or the basic Docker Registry) is strongly recommended. It simplifies scaling, image management, and ensures all nodes can pull images reliably.

How do I handle Spark dependencies in an offline cluster?

For Spark jobs that require external libraries (Maven/PyPI), you must pre-download these artifacts. You can either build custom Docker images containing these libraries or host a local Maven/PyPI mirror (e.g., using Sonatype Nexus or JFrog Artifactory) inside your air-gapped network.

What is the advantage of using Ilum in an air-gapped setup?

Ilum simplifies the management of Spark on Kubernetes by providing a unified control plane. In air-gapped environments, its ability to manage interactive sessions and jobs without reaching out to external cloud services makes it an ideal orchestrator for secure, on-prem data platforms.