- Install and configure Spark Operator
- Clone this repository.
- Apply templates with ServiceAccount, Role and Role Binding:
kubectl apply -f ./templates- Create configmap for application file:
kubectl create configmap demo-spark-job -n default --from-file=pi.py- Run Spark job
kubectl apply -f spark-with-configmap.yaml- Check driver logs. You will see the next text:
Pi is roughly 3.147400- Change some code in the ConfigMap. For example: Line
print("Pi is roughly %f" % (4.0 * count / n))to line
print("Pi is roughly %f" % (5.0 * count / n))- Delete your SparkApplication:
kubectl delete -f spark-with-configmap.yamlThen run it again:
kubectl apply -f spark-with-configmap.yaml- Check driver logs. You will see the next text:
Pi is roughly 3.919250- Fork this repository.
- Within your fork change repository address in the file spark-with-git-clone.yaml: Line
- https://github.com/jenoOvchi/spark-config-example.gitto line
- https://github.com/<your-github-name>/spark-config-example.git- Clone your fork repository.
- Run Spark job
kubectl apply -f spark-with-git-clone.yaml- Check driver logs. You will see the next text:
Pi is roughly 3.147400- Change some code in the file pi.py in your fork repository. For example: Line
print("Pi is roughly %f" % (4.0 * count / n))to line
print("Pi is roughly %f" % (5.0 * count / n))- Delete your SparkApplication:
kubectl delete -f spark-with-git-clone.yamlThen run it again:
kubectl apply -f spark-with-git-clone.yaml- Check driver logs. You will see the next text:
Pi is roughly 3.919250