我使用以下代码创建了一个集群
from dask_kubernetes import KubeCluster
cluster = KubeCluster.from_yaml('worker.yaml')
cluster.adapt(minimum=1, maximum=10)使用以下yaml代码(worker.yaml):
kind: Pod
metadata:
labels:
foo: bar
spec:
restartPolicy: Never
containers:
- image: daskdev/dask:latest
imagePullPolicy: IfNotPresent
args: [dask-worker, --nthreads, '4', --no-bokeh, --memory-limit, 3GB, --death-timeout, '300']
name: dask
resources:
limits:
cpu: "4"
memory: 3G
requests:
cpu: "2"
memory: 2G这就像预期的一样。现在,我添加了一个卷装载,如下所示
kind: Pod
metadata:
labels:
foo: bar
spec:
restartPolicy: Never
containers:
- image: daskdev/dask:latest
imagePullPolicy: IfNotPresent
args: [dask-worker, --nthreads, '4', --no-bokeh, --memory-limit, 3GB, --death-timeout, '300']
name: dask
resources:
limits:
cpu: "4"
memory: 3G
requests:
cpu: "2"
memory: 2G
volumeMounts:
- name: somedata
mountPath: /opt/some/data
volumes:
- name: somedata
azureFile:
secretName: azure-secret
shareName: somedata
readOnly: true我没有看到卷被挂载。但是当我简单地运行
kubectl create -f worker.yaml我可以看到卷正在挂载。
KubeCluster是否支持卷挂载?如果是这样,您如何配置它们?
发布于 2020-05-26 17:52:06
在使用HostPath卷进行测试时,我无法重现您的问题。
from dask_kubernetes import KubeCluster
cluster = KubeCluster.from_yaml('worker.yaml')
cluster.adapt(minimum=1, maximum=10)# worker.yaml
kind: Pod
metadata:
labels:
foo: bar
spec:
restartPolicy: Never
containers:
- image: daskdev/dask:latest
imagePullPolicy: IfNotPresent
args: [dask-worker, --nthreads, '4', --no-bokeh, --memory-limit, 3GB, --death-timeout, '300']
name: dask
resources:
limits:
cpu: "4"
memory: 3G
requests:
cpu: "2"
memory: 2G
volumeMounts:
- name: somedata
mountPath: /opt/some/data
volumes:
- name: somedata
hostPath:
path: /tmp/data
type: Directory如果对创建的工作进程运行kubectl describe po <podname>,则可以看到卷已成功创建。
Volumes:
somedata:
Type: HostPath (bare host directory volume)
Path: /tmp/data
HostPathType: Directory它被安装在我所期望的位置。
Mounts:
/opt/some/data from somedata (rw)另外,如果我使用kubectl exec -it <podname> bash和ls /opt/some/data在容器中创建一个外壳程序,我可以看到我在主机路径中创建的文件。
因此,卷可以与KubeCluster一起工作,所以如果您遇到azureFile存储的问题,那么您的Kubernetes集群一定存在一些配置问题。
https://stackoverflow.com/questions/60007738
复制相似问题