无法在gcePersistentDisk上为gke上的mongo pod挂载卷

时间:2019-04-05 12:59:16

标签: mongodb kubernetes google-kubernetes-engine

我尝试在gke上运行一个包含mongo容器的pod,并使用gcePersistentDisk挂载数据的持久卷,但挂载失败。

首先,我通过发出以下命令创建了永久磁盘:

gcloud compute disks create --size=1GiB --zone=europe-west3-a mongodb

然后,我使用以下代码创建了广告连播:

apiVersion: v1
kind: Pod
metadata:
  name: mongodb 
spec:
  volumes:
  - name: mongodb-data
    gcePersistentDisk:
      pdName: mongodb
      fsType: nfs4
  containers:
  - image: mongo
    name: mongodb
    volumeMounts:
    - name: mongodb-data
      mountPath: /data/db
    ports:
    - containerPort: 27017
      protocol: TCP

过一会儿,当我列出豆荚时,我得到的结果是:

NAME mongodb

READY 0/1    

STATUS ContainerCreating             

RESTARTS 0  

AGE 23m

And as a description of what's happened I get:

Warning  FailedMount             5m (x18 over 26m)  kubelet, gke-mongo-default-pool-02c59988-vmhz  MountVolume.MountDevice failed for volume "mongodb-data" : executable file not found in $PATH

Warning  FailedMount             4m (x10 over 24m)  kubelet, gke-mongo-default-pool-02c59988-vmhz  Unable to mount volumes for pod "mongodb_default(f1625bde-579d-11e9-a35f-42010a8a00a0)": timeout expired waiting for volumes to attach or mount for pod "default"/"mongodb". list of unmounted volumes=[mongodb-data]. list of unattached volumes=[mongodb-data default-token-5dxps]

我仍然不知道为什么它还没有准备好!有什么建议吗?

1 个答案:

答案 0 :(得分:1)

fsType:ext4而不是fsType:nfs4,这就是问题所在!