1 回答
TA贡献1846条经验 获得超7个赞
我遇到了类似的问题,最后我手动创建了客户端 Pod 所需的服务。就我而言,我想部署不支持集群模式的 Spark-thrift 服务器。
首先,您需要创建 Spark blockManager 和驱动程序本身所需的服务
apiVersion: v1
kind: Service
metadata:
name: spark-thrift
spec:
type: ClusterIP
ports:
- protocol: TCP
port: 4000
name: driver
- protocol: TCP
port: 4001
name: block-manager
现在你可以像这样启动你的驱动程序:
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: spark-thrift
labels:
app: spark-thrift
spec:
template:
spec:
containers:
- name: spark-thrift-driver
image: image:latest
command:
- /opt/spark/bin/spark-submit
args:
- "--name"
- "spark-thrift"
- "--class"
- "org.apache.spark.sql.hive.thriftserver.HiveThriftServer2"
- "--conf"
- "spark.driver.port=4000"
- "--conf"
- "spark.driver.host=spark-thrift"
- "--conf"
- "spark.driver.bindAddress=0.0.0.0"
- "--conf"
- "spark.driver.blockManager.port=4001"
imagePullPolicy: Always
ports:
- name: driver
containerPort: 4000
- name: blockmanager
containerPort: 4001
这里的重要论点是
“spark.driver.host=spark-thrift” - 指向主机(因此是服务名称)
“spark.driver.port=4000” - 指向驱动程序端口
“spark.driver.bindAddress=0.0.0.0” - 这是spark不使用spark-thrift作为主机名所必需的,否则会导致错误
“spark.driver.blockManager.port=4001” - 指向 blockManager 端口
显然,这不是一个工作 Pod 的完整示例,您仍然需要在规范中配置您自己的端口和卷。
添加回答
举报