您现在的位置是:首页 > 文章详情

使用describe命令进行Kubernetes pod错误排查

日期:2018-11-19点击:524

我有一个pod名叫another,用kubectl create创建后发现过了29分钟,状态还是处于ContainerCreating阶段。

使用kubectl describe命令检查:

从错误消息发现是因为这个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'

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:

用命令kubectl get pv, 发现当前所有的persistent volume都被占用了(BOUND状态):

解决方案有很多种,处于测试目的,我只是简单地将另一个同样声明了nginx-pvc作为PersistentVolumeClaim的pod删除,然后这个名为another的pod状态就很快变成Running了:

从describe命令生成的日志里也能清楚的观察到这个成功mount volume的事件:

Normal SuccessfulAttachVolume 84s attachdetach-controller AttachVolume.Attach succeeded for volume "pvc-c4d41f5c-e7ed-11e8-8726-fe6d42bf075f"

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

原文链接:https://yq.aliyun.com/articles/672166
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章