我有一個pod名叫another,用kubectl create建立後發現過了29分鐘,狀態仍是處於ContainerCreating階段。nginx
使用kubectl describe命令檢查:api
從錯誤消息發現是由於這個pod attach volume失敗:測試
FailedAttachVolume 2m1s (x22 over 31m) attachdetach-controller AttachVolume.Attach failed for volume "pvc-c4d41f5c-e7ed-11e8-8726-fe6d42bf075f" : googleapi: Error 400: RESOURCE_IN_USE_BY_ANOTHER_RESOURCE - The disk resource 'projects/sap-pi-coo-acdc-dev/zones/europe-west1-b/disks/shoot--k8s-train--shac-pvc-c4d41f5c-e7ed-11e8-8726-fe6d42bf075f' is already being used by 'projects/sap-pi-coo-acdc-dev/zones/europe-west1-b/instances/shoot--k8s-train--shacw46-worker-prvfv-z1-7844dc6744-ghd5m'google
Warning FailedMount 31s (x14 over 29m) kubelet, shoot--k8s-train--shacw46-worker-prvfv-z1-7844dc6744-hhrmd Unable to mount volumes for pod "another_part-0110(13f15fa4-e819-11e8-8726-fe6d42bf075f)": timeout expired waiting for volumes to attach or mount for pod "part-0110"/"another". list of unmounted volumes=[content-storage]. list of unattached volumes=[content-storage default-token-6z5sk]日誌
查看這個pod的yaml文件,果真發現有一個persistent volume的claim:orm
用命令kubectl get pv, 發現當前全部的persistent volume都被佔用了(BOUND狀態):blog
解決方案有不少種,處於測試目的,我只是簡單地將另外一個一樣聲明瞭nginx-pvc做爲PersistentVolumeClaim的pod刪除,而後這個名爲another的pod狀態就很快變成Running了:token
從describe命令生成的日誌裏也能清楚的觀察到這個成功mount volume的事件:事件
Normal SuccessfulAttachVolume 84s attachdetach-controller AttachVolume.Attach succeeded for volume "pvc-c4d41f5c-e7ed-11e8-8726-fe6d42bf075f"get
要獲取更多Jerry的原創文章,請關注公衆號"汪子熙":