![](/img/trans.png)
[英]Mount a directory from a different host as a volume in mongo docker container
[英]Failed to mount a volume on gcePersistentDisk for mongo pod on gke
我嘗試在包含mongo容器的gke上運行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
一段時間后,當我列出豆莢時,我得到的結果是:
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]
我仍然不知道為什么它還沒有准備好! 有什么建議嗎?
fsType:ext4而不是fsType:nfs4,這就是問題所在!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.