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

2019-05-18 16:14 (6 years ago)
When Pods Fail to Start with ContainerCreating (FailedMount) in Kubernetes

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

Please rate this article
Current rating: 4.0 (1)
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive