Categories
bigdata bigdata/flink bigdata/spark bigdata/topics cicd cicd/jenkins cicd/travis data-science docker git kubernetes kubernetes/minikube kubernetes/prometheus kubernetes/tools shell springbootTags
Attention:
- Please make sure you local machine can be accessed by the
pod
in kubernetes cluster. Because once you have submitted the job from scala shell, the executor will need to communicate withdriver node
to fetch the source data. - If you use
sc.textFile()
to createRDD
Object, plz make sure the file exists at the same path on your local machine and you pod.
Command
1 | ./bin/spark-shell |
--master
: set the cluster managerspark.kubernetes.container.image
: tell driver to using which image to launch executorspark.kubernetes.container.namespace
: which namespace to run podspark.kubernetes.authenticate.driver.serviceAccountName
: you’d better create an role to authorize executor pod to create other resouces like configMap and service.spark.kubernetes.executor.volumes.hostPath.hostpath-pv.mount.path
: thepath in executor pods mapping to the host path in host machinespark.kubernetes.executor.volumes.hostPath.hostpath-pv.mount.readOnly
: grant write access to thespark.kubernetes.executor.volumes.hostPath.hostpath-pv.options.path
: the path in host machine you wanna mount
About hostPath
volume
Before creating a local persistent volume, you have to create a local-storage
class. Explanation here: kubernetes storage class
1 | apiVersion: storage.k8s.io/v1 |
Then, now you can create the persistent volume to use the path in different pod.
1 | apiVersion: v1 |
Referred article: