我正在使用舵图将火花部署到GCE中的Kubernetes。我已经在extraVolumes
和extraVolumeMounts
中配置了values.yaml,它们是在部署期间成功创建的。
在图表部署期间,向这些卷添加文件的正确方法是什么?
## Array to add extra volumes
extraVolumes:
- name: spark-volume
## Array to add extra mounts (normally used with extraVolumes)
extraVolumeMounts:
- name: spark-volume
mountPath: /tmp/new-data
发布于 2020-02-18 16:43:43
这要看文件在哪里了。如果你把它们放在回购工具里,我会用initContainer
来克隆它。
这个看起来可能是这样的:
initContainers:
- name: git-clone-spark-volumes
image: alpine/git
args:
- clone
- --single-branch
- --branch=master
- --depth=1
- --
- https://github.com/your/repo.git
- /tmp/new-data
securityContext:
runAsUser: 0
volumeMounts:
- name: spark-volume
mountPath: /tmp/new-data
extraVolumes:
- name: spark-volume
emptyDir: {}
extraVolumeMounts:
- name: spark-volume
mountPath: /tmp/new-data
这会将回购(https://github.com/your/repo.git)复制到/tmp/new-data
文件夹中,并将火花卷安装到其中.
如果您的文件是基于key=value
的,则可以使用ConfigMap
$ kubectl create configmap spark-volume --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties
可用于:
extraVolumes:
- name: spark-volume
configMap:
name: spark-volume
extraVolumeMounts:
- name: spark-volume
mountPath: /tmp/new-data
这在配置Pod以使用ConfigMap上有很好的描述。
https://stackoverflow.com/questions/60280381
复制相似问题