Error "invalid mode" installing mongodb with helm on kubernetes from docker windows

3/25/2018

I am experimenting with Kubernetes and helm. I have installed k8s through docker windows and created a cluster. I have successfully installed the dashboard and helm. After running helm install stable/mongodb I see the following error in the k8s dashboard Error: Error response from daemon: invalid mode: /bitnami/mongodb. /bitnami/mongodb is the default mount point of the persistent volume created by the mongodb chart.

Here is a screenshot of my dashboard.

enter image description here

I am not really sure how to debug this further. I am very new to this so I am likely missing something obvious. Any pointers?

-- imagio
docker
kubernetes
kubernetes-helm

2 Answers

3/25/2018

I solved this issue by switching to Docker Toolbox and minikube which uses Virtualbox instead of hyperv. Installing mongodb via helm works perfectly as expected. It seems that there are some issues with kubernetes installed in hyperv by the Docker for Windows installer.

-- imagio
Source: StackOverflow

3/25/2018

k8s through docker windows

That is almost certainly the cause of your trouble, as Windows and its filesystems are not in the same mental model as the traditionally Linux-y docker world. Thus, it is extremely unlikely that those directories are owned by the correct Linux user-id, and even less likely that they are the correct "permission bits" (rwx) for whatever mongodb is expecting.

There are a couple of ways of testing this theory:

  • If your docker-for-windows is actually running in a Linux virtual machine (as would be the case for docker-machine backed by VirtualBox, VMware, etc), then you can change the volume: for the Pod to be emptyDir: {} or hostPath: since those directories will actually reside on the Linux virtual machine. I think that may be true for a Hyper-V backed docker-machine VM, too, but I don't have as much experience with them
  • If you are using an actual dockerd built as a Win32/Win64 application (unlikely, but I guess possible), then you can try switching to NFS (assuming mongodb doesn't whine) since AFAIK one has more influence over the UID and permission-bit mapping when mounting NFS folders

If you experience that with emptyDir: or hostPath: the application boots up, then you now have the challenge of finding some storage mechanism that uses a Linux-friendly filesystem and using it on Windows. Again, in the circumstance where you have a virtual machine, there's a pretty good chance you can attach virtual disks to the machine, format them with a Linux filesystem, and be back in business. The same is mostly true for network-backed filesystems, modulo one would want to be cautious about network-backed filesystems and database-y things like mongodb -- especially mongodb.

If I might offer an opinion, separate from what I hope is some constructive debugging tips: you are just asking for a world of pain trying to do that stuff on Windows. It hasn't had nearly the amount of hours spent exercising those circumstances, and nor does it have nearly the ecosystem for finding solutions. Merely for your consideration.

-- mdaniel
Source: StackOverflow