希望你们中的一些人对此有解决方案:
我有一个python代码,应该编写一个文件output.csv,我想在名为/ data的文件夹中的容器外部找到该文件, 我有一个glusterfs卷。所以我正在使用Kubernetes来部署我的容器。然后当它运行时,我应该在glusterfs的文件夹中找到该文件:这是我的Yaml文件: glusterfs体积:
[xxx@xxxx ~]$ df |grep gluster
/dev/mapper/glustervg-glusterlv 10471424 1633164 8838260 16% /var/lib/glusterfs
xxxx:/gluster_vol 10471424 1737876 8733548 17% /data
感谢您的帮助
更新: 我已按照本教程尝试使用glusterfs部署卷 https://docs.openshift.com/container-platform/3.7/install_config/storage_examples/gluster_example.html
所以我创建了这些文件: gluster endpoit.yaml
apiVersion: v1
kind: Endpoints
metadata:
name: gluster-cluster
subsets:
- addresses:
- ip: 10.122.5.143
ports:
- port: 1
protocol: TCP
- addresses:
- ip: 10.122.5.142
ports:
- port: 1
protocol: TCP
持久卷:
apiVersion: v1
kind: PersistentVolume
metadata:
name: gluster-pv
spec:
capacity:
storage: 3Gi
accessModes:
- ReadWriteMany
glusterfs:
endpoints: gluster-cluster
path: data
readOnly: false
persistentVolumeReclaimPolicy: Retain
持续批量索赔:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: gluster-claim
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 3Gi
gluster服务:
apiVersion: v1
kind: Service
metadata:
name: gluster-cluster
spec:
ports:
- port:
我的新部署如下:
apiVersion: apps/v1
kind: Deployment
metadata:
name: uc1-deploy
spec:
selector:
matchLabels:
app: uc1
replicas: 1
template:
metadata:
labels:
app: uc1
spec:
containers:
- name: uc1
image: predicteur_uc1:1.5
volumeMounts:
- mountPath: /output
name: test-volumed
readOnly: false
ports:
- containerPort: 90
volumes:
- name: test-volumed
persistentVolumeClaim:
claimName: gluster-claim
当我部署它时,我得到那个错误:
Output: Running scope as unit run-20456.scope.
[2019-11-25 11:29:08.230125] E [glusterfsd.c:825:gf_remember_backup_volfile_server] 0-glusterfs: failed to set volfile server: File exists
Mount failed. Please check the log file for more details.
, the following error information was pulled from the glusterfs log to help diagnose this issue:
[2019-11-25 11:29:08.244765] E [glusterfsd-mgmt.c:1958:mgmt_getspec_cbk] 0-glusterfs: failed to get the 'volume file' from server
[2019-11-25 11:29:08.244841] E [glusterfsd-mgmt.c:2151:mgmt_getspec_cbk] 0-mgmt: failed to fetch volume file (key:/data)
答案 0 :(得分:1)
正如OP在评论中已经提到的那样,问题在于spec.glusterfs.path
中的PersistentVolume
设置为在系统上挂载glusterfs卷的目录的名称。
将其值设置为实际的glusterfs卷路径(/gluster_vol
而非data
)解决了该问题。
答案 1 :(得分:1)
是,该值必须为gluster_vol,而不是数据,该数据表示在机器上安装了glusterfs的文件夹,但卷名称为gluster_vol。那是我犯的第一个错误。
第二次部署中的安装路径表示必须在其中安装我的gluster_vol(及其包含的内容)的容器内的一个文件夹,以便它在与gluster vol链接的容器内创建一个文件夹,因此基本上我将放置任何内容在文件夹输出中的gluster_vol上,位于我的容器内。
我的第三个python代码创建了文件夹输出/机会中的csv文件,因此该文件夹结构也必须位于gluster_vol中。谢谢helloWorld和Clement对您的影响,您提供了帮助