【问题标题】:Failed to mount a volume on gcePersistentDisk for mongo pod on gke无法为 gke 上的 mongo pod 在 gcePersistentDisk 上挂载卷
【发布时间】:2019-04-05 21:54:20
【问题描述】:

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

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

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

然后,我使用以下代码创建了 pod:

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

一段时间后,当我列出 pod 时,我得到了结果:

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]

我还是不明白为什么它还没有准备好!请问有什么建议吗?

【问题讨论】:

    标签: mongodb kubernetes google-kubernetes-engine


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-23
      • 1970-01-01
      • 2016-04-18
      • 2021-02-13
      • 2016-12-24
      • 2021-07-14
      相关资源
      最近更新 更多