我有一个Kubernetes部署,其中一个吊舱应该安装PD。Kubernetes部署无法安装卷,尽管等效的gcloud/mnt工作正常
在spec.template.spec.containers.[*]
我有这样的:
volumeMounts:
- name: app-volume
mountPath: /mnt/disk/app-pd
和下spec.template.spec
在于:
volumes:
- name: app-volume
gcePersistentDisk:
pdName: app-pd
fsType: ext4
app-pd
是GCE永久磁盘上有一个单一ext4
文件系统(因此无分区)。如果我运行kubectl create
我得到这些错误信息从kubectl describe pod
:
Warning FailedMount Unable to mount volumes for pod "<id>":
timeout expired waiting for volumes to attach/mount for pod"<id>"/"default".
list of unattached/unmounted volumes=[app-volume]
Warning FailedSync Error syncing pod, skipping:
timeout expired waiting for volumes to attach/mount for pod "<id>"/"default".
list of unattached/unmounted volumes=[app-volume]
在运行的吊舱,/var/log/kubelet.log
包含这些错误消息,这些消息可能涉及到,甚至引起上述的重复的VM实例:
reconciler.go:179]
VerifyControllerAttachedVolume operation started for volume "kubernetes.io/gce-pd/<id>"
(spec.Name: "<id>") pod "<id>" (UID: "<id>")
goroutinemap.go:155]
Operation for "kubernetes.io/gce-pd/<id>" failed.
No retries permitted until <date> (durationBeforeRetry 2m0s).
error: Volume "kubernetes.io/gce-pd/<id>" (spec.Name: "<id>") pod "<id>" (UID: "<id>")
is not yet attached according to node status.
但是,如果我尝试将PD连接到运行带有gcloud compute instances attach-disk
和gcloud compute ssh
的pod的VM实例,我可以看到这些文件已创建。
/dev/disk/by-id/google-persistent-disk-1
如果我装入它(PD),我可以看到并使用预期的文件。
如何进一步诊断此问题并最终解决该问题?
难道问题是该文件被称为/dev/disk/google-persistent-disk-1
而不是/dev/disk/google-<id>
,如果我想从云控制台UI装载它们,会发生这种情况吗?
UPDATE我已经通过用一个单一的ext4
文件系统(因此无分区)格式化的磁盘简化设置和编辑上述相应描述。我还添加了更多来自kubelet.log
的错误指示。
UPDATE如果我在部署到将托管该pod的实例VM之前手动添加PD(在云控制台UI中),问题仍然存在。 PD和实例VM都在同一个区域。
UPDATE根据GCE #211,相同永久磁盘的块设备名称中观察到的差异是正常的。
似乎也类似于Kubernetes [#28709](https://github.com/kubernetes/kubernetes/issues/28709)。 – Drux