spark-history-server

Spark History Server

A Helm chart and Docker container for deploying Spark History Server (Spark Web UI) to monitor the metrics and performance of your Spark jobs.

Overview

This project provides two main components:

  1. A Docker image for Spark History Server configured to read Spark Event Logs
  2. A Helm chart for deploying Spark History Server in Kubernetes

Spark History Server provides a web interface that visualizes information about completed Spark applications, including event timelines, stages, and executor metrics.

Docker Image

Prerequisites

Building the Docker Image

git clone https://github.com/kubedai/spark-history-server.git
cd spark-history-server
docker build -t $USER/spark-web-ui:latest .

Running the Docker Container Locally

The repository includes a helper script to simplify running the container locally. The script supports the following actions:

sh launch_spark_history_server_locally.sh {start|stop|restart|status|help} [options]

Example: Starting the container with S3 bucket

sh launch_spark_history_server_locally.sh start -sb my-bucket -sp spark/history/events

Options:

When started, you can access the Spark History Server at http://localhost:18080

Helm Chart Deployment

Prerequisites

Creating IAM Role for Service Account (AWS EKS only)

If deploying on EKS and using S3 for Spark Event logs, you’ll need to create an IAM Role for Service Accounts:

eksctl create iamserviceaccount \
  --cluster=<eks-cluster-name> \
  --name=spark-history-server \
  --namespace=spark-history-server \
  --attach-policy-arn=arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess

Installing the Helm Chart

Add the repository and update:

helm repo add kubedai https://kubedai.github.io/spark-history-server
helm repo update

Install the chart:

helm install spark-history-server kubedai/spark-history-server --namespace spark-history-server

Configuration

Before deploying, you’ll need to update the values.yaml file with:

  1. Service account annotations (with IRSA role ARN for AWS EKS)
  2. S3 bucket info for Spark event logs

Example values:

serviceAccount:
  create: false
  annotations:
    eks.amazonaws.com/role-arn: "<ENTER_IRSA_IAM_ROLE_ARN_HERE>"
  name: "spark-history-server"

sparkHistoryOpts: "-Dspark.history.fs.logDirectory=s3a://<ENTER_S3_BUCKET_NAME>/<PREFIX_FOR_SPARK_EVENT_LOGS>/"

Accessing Spark History Server UI

Using port-forward

kubectl port-forward services/spark-history-server 18085:80 -n spark-history-server

Then open a browser and navigate to http://localhost:18085/

Using Ingress

If you have configured an ingress, you can access the UI through the ingress URL.

Managing the Helm Release

Upgrade the chart:

helm upgrade spark-history-server --namespace spark-history-server

Uninstall the chart:

helm uninstall spark-history-server --namespace spark-history-server

Community

Give us a star ⭐️ - If you are using Spark History Server, we would love a star ❤️

License

This project is licensed under the Apache License 2.0.