Kubernetes 1.17.2 Rancher 2.3.5 CreateContainerConfigError: stat no such file or directory but the directory IS there

4/6/2020

From time to time, in my 8-nodes Kubernetes 1.17.2 cluster managed by Rancher 2.3.5 single-node install, I happen to stumble upon this weird error, which actually says a folder isn't there but... it is! The first occurrence of this error, which actually prevents the afflicted container from being able to start at all, were related to my striving in getting a GlusterFS volume across 3 of my worker nodes reckoned as a standard storage provider! So I've tried torchbox/k8s-hostpath-provisioner, but also rancher.io/local-path; from time to time, though, this weird error about the provisioned directory being misconfigured happened on new, specific services, so I've just decided to ditch them off, and move forward. Now I'm really stopped, because there aren't so many alternatives to a K8s-deployed mailserver such as tomav/docker-mailserver, but it is still refusing to start throwing this CreateContainerConfigError, even after I've completely deleted it and patched its YAML manifest as the use K8s standard "hostPath" volumeMount instead of my testing provisioners:

FROM THIS:

volumes:
  - name: data
    persistentVolumeClaim:
      claimName: mail-storage

TO THIS:

volumes:
  - name: data
    hostPath:
      path: /mnt/gvol2/docker-mailserver
      type: ""

I've adapted this last code from another sample service I'm using with Rancher "Bind Mount" as a Volume in the GUI; docker-mailserver looks precisely the same in the Rancher GUI, no errors can be seen, so Volume definition seems OK. Why I get this "CreateContainerConfigError", so? Any help will be much appreciated!

-- adalberto caccia
docker
kubernetes
rancher
storage

1 Answer

4/6/2020
type: "DirectoryOrCreate"    

solved the mystery! Apparently, K8s is not going to actually stat() the directory when it is not directly created by itself!

-- adalberto caccia
Source: StackOverflow