The following examples have the following spec
fields in common:
-
version
: the current version is "1.0" -
sparkImage
: the docker image that will be used by job, driver and executor pods. This can be provided by the user. -
mode
: onlycluster
is currently supported -
mainApplicationFile
: the artifact (Java, Scala or Python) that forms the basis of the Spark job. -
args
: these are the arguments passed directly to the application. In the examples below it is e.g. the input path for part of the public New York taxi dataset. -
sparkConf
: these list spark configuration settings that are passed directly tospark-submit
and which are best defined explicitly by the user. Since theSparkApplication
"knows" that there is an external dependency (the s3 bucket where the data and/or the application is located) and how that dependency should be treated (i.e. what type of credential checks are required, if any), it is better to have these things declared together. -
volumes
: refers to any volumes needed by theSparkApplication
, in this case an underlyingPersistentVoulmeClaim
. -
driver
: driver-specific settings, including any volume mounts. -
executor
: executor-specific settings, including any volume mounts.
Job-specific settings are annotated below.
link:example$example-sparkapp-external-dependencies.yaml[role=include]
-
Job python artifact (external)
-
Job argument (external)
-
List of python job requirements: these will be installed in the pods via
pip
-
Spark dependencies: the credentials provider (the user knows what is relevant here) plus dependencies needed to access external resources (in this case, in s3)
-
the name of the volume mount backed by a
PersistentVolumeClaim
that must be pre-existing -
the path on the volume mount: this is referenced in the
sparkConf
section where the extra class path is defined for the driver and executors
link:example$example-sparkapp-image.yaml[role=include]
-
Job image: this contains the job artifact that will be retrieved from the volume mount backed by the PVC
-
Job python artifact (local)
-
Job argument (external)
-
List of python job requirements: these will be installed in the pods via
pip
-
Spark dependencies: the credentials provider (the user knows what is relevant here) plus dependencies needed to access external resources (in this case, in an S3 store)
-
the name of the volume mount backed by a
PersistentVolumeClaim
that must be pre-existing -
the path on the volume mount: this is referenced in the
sparkConf
section where the extra class path is defined for the driver and executors
link:example$example-sparkapp-pvc.yaml[role=include]
-
Job artifact located on S3.
-
Job main class
-
Spark dependencies: the credentials provider (the user knows what is relevant here) plus dependencies needed to access external resources (in this case, in an S3 store, accessed without credentials)
-
the name of the volume mount backed by a
PersistentVolumeClaim
that must be pre-existing -
the path on the volume mount: this is referenced in the
sparkConf
section where the extra class path is defined for the driver and executors
link:example$example-sparkapp-s3-private.yaml[role=include]
-
Job python artifact (located in an S3 store)
-
Artifact class
-
S3 section, specifying the existing secret and S3 end-point (in this case, MinIO)
-
Credentials referencing a secretClass (not shown in is example)
-
Spark dependencies: the credentials provider (the user knows what is relevant here) plus dependencies needed to access external resources…
-
…in this case, in an S3 store, accessed with the credentials defined in the secret
-
the name of the volume mount backed by a
PersistentVolumeClaim
that must be pre-existing -
the path on the volume mount: this is referenced in the
sparkConf
section where the extra class path is defined for the driver and executors
link:example$example-configmap.yaml[role=include]
link:example$example-sparkapp-configmap.yaml[role=include]
-
Name of the configuration map
-
Argument required by the job
-
Job scala artifact that requires an input argument
-
The volume backed by the configuration map
-
The expected job argument, accessed via the mounted configuration map file
-
The name of the volume backed by the configuration map that will be mounted to the driver/executor
-
The mount location of the volume (this will contain a file
/arguments/job-args.txt
)
You can specify S3 connection details directly inside the SparkApplication
specification or by referring to an external S3Bucket
custom resource.
To specify S3 connection details directly as part of the SparkApplication
resource you add an inline bucket configuration as shown below.
s3bucket: # (1)
inline:
bucketName: my-bucket # (2)
connection:
inline:
host: test-minio # (3)
port: 9000 # (4)
accessStyle: Path
credentials:
secretClass: s3-credentials-class # (5)
-
Entry point for the bucket configuration.
-
Bucket name.
-
Bucket host.
-
Optional bucket port.
-
Name of the
Secret
object expected to contain the following keys:ACCESS_KEY_ID
andSECRET_ACCESS_KEY
It is also possible to configure the bucket connection details as a separate Kubernetes resource and only refer to that object from the SparkApplication
like this:
s3bucket:
reference: my-bucket-resource # (1)
-
Name of the bucket resource with connection details.
The resource named my-bucket-resource
is then defined as shown below:
---
apiVersion: s3.stackable.tech/v1alpha1
kind: S3Bucket
metadata:
name: my-bucket-resource
spec:
bucketName: my-bucket-name
connection:
inline:
host: test-minio
port: 9000
accessStyle: Path
credentials:
secretClass: minio-credentials-class
This has the advantage that bucket configuration can be shared across `SparkApplication`s and reduces the cost of updating these details.
Below are listed the CRD fields that can be defined by the user:
CRD field | Remarks |
---|---|
|
|
|
|
|
Job name |
|
"1.0" |
|
|
|
User-supplied image containing spark-job dependencies that will be copied to the specified volume mount |
|
Spark image which will be deployed to driver and executor pods, which must contain spark environment needed by the job e.g. |
|
Optional Enum (one of |
|
An optional list of references to secrets in the same namespace to use for pulling any of the images used by a |
|
The actual application file that will be called by |
|
The main class i.e. entry point for JVM artifacts |
|
Arguments passed directly to the job artifact |
|
S3 bucket and connection specification. See the S3 bucket specification for more details. |
|
A map of key/value strings that will be passed directly to |
|
A list of python packages that will be installed via |
|
A list of packages that is passed directly to |
|
A list of excluded packages that is passed directly to |
|
A list of repositories that is passed directly to |
|
A list of volumes |
|
The volume name |
|
The persistent volume claim backing the volume |
|
Number of cores used by the driver (only in cluster mode) |
|
Total cores for all executors |
|
Specified memory for the driver |
|
A list of mounted volumes for the driver |
|
Name of mount |
|
Volume mount path |
|
A dictionary of labels to use for node selection when scheduling the driver N.B. this assumes there are no implicit node dependencies (e.g. |
|
Number of cores for each executor |
|
Number of executor instances launched for this job |
|
Memory specified for executor |
|
A list of mounted volumes for each executor |
|
Name of mount |
|
Volume mount path |
|
A dictionary of labels to use for node selection when scheduling the executors N.B. this assumes there are no implicit node dependencies (e.g. |