<p>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:</p>

<p>FROM THIS:</p>

<pre><code>volumes:
  - name: data
    persistentVolumeClaim:
      claimName: mail-storage
</code></pre>

<p>TO THIS:</p>

<pre><code>volumes:
  - name: data
    hostPath:
      path: /mnt/gvol2/docker-mailserver
      type: ""
</code></pre>

<p>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!</p>

<pre><code>type: "DirectoryOrCreate"    
</code></pre>

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