我尝试在单节点GKE群集上运行2个Kubernetes pod,共享一个只读GCE永久磁盘,但是当一个pod成功运行时,另一个pod处于ContainerCreating
状态。
容器非常简单:
FROM debian:jessie
CMD ["/bin/sh", "-c", "while true; do ls /mount; sleep 5; done"]
部署如下所示:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dumpy
spec:
replicas: 2
template:
metadata:
labels:
app: dump
spec:
containers:
- name: dump
image: gcr.io/myproject/dump
volumeMounts:
- mountPath: /mount
name: dump
readOnly: true
volumes:
- name: dump
gcePersistentDisk:
pdName: my-disk
fsType: ext4
readOnly: true
失败的广告连播报告:
Warning FailedMount Unable to mount volumes for pod "xxx". Could not attach GCE PD "my-disk". Timeout waiting for mount paths to be created.
FailedSync Error syncing pod, skipping: Could not attach GCE PD "my-disk". Timeout waiting for mount paths to be created.
/var/log/kubelet.log
报告:
gce.go:422] GCE operation failed: googleapi: Error 400: The disk resource 'my-disk' is already being used by 'xxx-123'
gce_util.go:187] Error attaching PD "my-disk": googleapi: Error 400: The disk resource 'my-disk' is already being used by 'xxx-123'
我相信Kubernetes documentation明确允许这种情况。
PD的一个特点是它们可以同时由多个消费者以只读方式安装。这意味着您可以使用数据集预先填充PD,然后根据需要从多个pod中并行提供它。
发生了什么以及解决了什么?
答案 0 :(得分:2)
对此没有好的解决方法。
它由https://github.com/kubernetes/kubernetes/pull/26351修复,它将成为计划于6月底(https://github.com/kubernetes/kubernetes/wiki/Release-1.3)发布的下一个Kubernetes版本(v1.3)的一部分。