When Pods Fail to Start with ContainerCreating (FailedMount) in Kubernetes

2019-05-19 01:14 (5 years ago) ytyng

Environment: Kubernetes  v1.13.5 (Rancher)

When a Pod in Kubernetes fails to start,

and you check the pods with `kubectl get pods`,

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
d-ytyng-com-deployment-755c9d8dcb-9j7dn 0/1 ContainerCreating 0 8m24s
php56-alpine-deployment-799dbf8d6f-x2gfj 0/1 ContainerCreating 0 8m24s

you might see that the status is stuck at ContainerCreating.

When you check the pods with `kubectl describe pods`,

Warning FailedMount 6s (x7 over 38s) kubelet, <cluster-name> MountVolume.SetUp failed for volume "src" : hostPath type check failed: /xxx/xxx/src is not a directory

You may encounter a warning like this.

However, the path /xxx/xxx/src does exist.

In that case, in the manifest YAML,

volumes:
- name: src
hostPath:
path: /xxx/xxx/src
type: Directory

if you remove

type: Directory

it should work.

Reference:

docker - MountVolume.SetUp failed for volume "mongo" : hostPath type check failed: /mongo/data is not a directory - Stack Overflow
https://stackoverflow.com/questions/48927312/mountvolume-setup-failed-for-volume-mongo-hostpath-type-check-failed-mongo

Current rating: 4

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011