mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Make spark master configurable
This commit is contained in:
parent
b4f58a9a17
commit
fa36c18e37
4 changed files with 17 additions and 3 deletions
|
|
@ -56,7 +56,7 @@ Get `zeppelin-server.yaml` from github repository or find it from Zeppelin distr
|
|||
$ curl -s -O https://raw.githubusercontent.com/apache/zeppelin/master/k8s/zeppelin-server.yaml
|
||||
|
||||
# or get it from Zeppelin distribution package.
|
||||
$ ls <zeppelin-distribution/k8s/zeppelin-server.yaml
|
||||
$ ls <zeppelin-distribution>/k8s/zeppelin-server.yaml
|
||||
```
|
||||
|
||||
Start zeppelin on kubernetes cluster,
|
||||
|
|
@ -113,7 +113,7 @@ And then start your spark interpreter
|
|||
sc.parallelize(1 to 100).count
|
||||
...
|
||||
```
|
||||
Spark executors will be automatically created in your Kubernetes cluster.
|
||||
While `master` property of SparkInterpreter starts with `k8s://` (default `k8s://https://kubernetes.default.svc` when Zeppelin started using zeppelin-server.yaml), Spark executors will be automatically created in your Kubernetes cluster.
|
||||
Spark UI is accessible by clicking `SPARK JOB` on the Paragraph.
|
||||
|
||||
Check [here](https://spark.apache.org/docs/latest/running-on-kubernetes.html) to know more about Running Spark on Kubernetes.
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ spec:
|
|||
configMapKeyRef:
|
||||
name: zeppelin-server-conf
|
||||
key: serviceDomain
|
||||
- name: MASTER # default value of master property for spark interpreter.
|
||||
value: k8s://https://kubernetes.default.svc
|
||||
- name: zeppelin-server-gateway
|
||||
image: nginx:1.14.0
|
||||
command: [ "/bin/sh", "-c" ]
|
||||
|
|
|
|||
|
|
@ -267,7 +267,9 @@ public class K8sRemoteInterpreterProcess extends RemoteInterpreterProcess {
|
|||
if (isSpark()) {
|
||||
int webUiPort = 4040;
|
||||
k8sProperties.put("zeppelin.k8s.spark.container.image", sparkImage);
|
||||
envs.put("SPARK_SUBMIT_OPTIONS", envs.getOrDefault("SPARK_SUBMIT_OPTIONS", "") + buildSparkSubmitOptions());
|
||||
if (isSparkOnKubernetes(properties)) {
|
||||
envs.put("SPARK_SUBMIT_OPTIONS", envs.getOrDefault("SPARK_SUBMIT_OPTIONS", "") + buildSparkSubmitOptions());
|
||||
}
|
||||
envs.put("SPARK_HOME", envs.getOrDefault("SPARK_HOME", "/spark"));
|
||||
|
||||
// configure interpreter property "zeppelin.spark.uiWebUrl" if not defined, to enable spark ui through reverse proxy
|
||||
|
|
@ -290,6 +292,15 @@ public class K8sRemoteInterpreterProcess extends RemoteInterpreterProcess {
|
|||
return "spark".equalsIgnoreCase(interpreterGroupName);
|
||||
}
|
||||
|
||||
boolean isSparkOnKubernetes(Properties interpreteProperties) {
|
||||
String propertySparkMaster = (String) interpreteProperties.getOrDefault("master", "");
|
||||
if (propertySparkMaster.startsWith("k8s://")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
String buildSparkSubmitOptions() {
|
||||
StringBuilder options = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ public class K8sRemoteInterpreterProcessTest {
|
|||
|
||||
Properties properties = new Properties();
|
||||
properties.put("my.key1", "v1");
|
||||
properties.put("master", "k8s://http://api");
|
||||
HashMap<String, String> envs = new HashMap<String, String>();
|
||||
envs.put("MY_ENV1", "V1");
|
||||
envs.put("SPARK_SUBMIT_OPTIONS", "my options");
|
||||
|
|
|
|||
Loading…
Reference in a new issue