Addyvan / valheim-k8s

valheim game-server on kubernetes
MIT License
94 stars 45 forks source link

MountVolume.SetUp failed for volume "gamefiles" : hostPath type check failed: /data/valheim is not a directory #27

Closed rocket357 closed 3 years ago

rocket357 commented 3 years ago

Hitting https://github.com/kubernetes/kubernetes/issues/90263

Solution is to change "type: Directory" to "type: DirectoryOrCreate" or remove the "type: Directory" check altogether (both commits tested in the PR).

Running via ArgoCD v2.0.0+f5119c0 on:

C:\Users\Jonathon\rancher> kubectl version Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"windows/amd64"} Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:32:58Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}

rocket357 commented 3 years ago

Upgraded to rke 1.27 and upgraded the cluster to kubernetes 1.20.5. Fresh launch in argocd gives:

Scheduled Successfully assigned valheim-test/valheim-server-6fd49b4644-c2w6g to m3.rke.example.org

FailedMount MountVolume.SetUp failed for volume "gamefiles" : hostPath type check failed: /data/valheim-test is not a directory 4

Addyvan commented 3 years ago

**** Approved and merged

edit: IGNORE MY COMMENTS, I thought this was an issue!!!

Hi @rocket357, sorry for the late response!

This error is due to the folder not being present on the node. If you are using a hostPath, the path must be present ahead of time given the way it is configured.

I believe there might be a "createIfMissing" flag in the syntax; however, it wouldn't be something we would want to enable by default.

A statefulset + volumeClaimTemplates is how I would personally host this for myself. The deployment + hostPath is the easiest way for people to get up and running.