consul-on-kubernetes icon indicating copy to clipboard operation
consul-on-kubernetes copied to clipboard

Data dir permissions issue in Minikube

Open pbitty opened this issue 8 years ago • 4 comments

Hello,

I'm following this tutorial on a local minikube cluster and Consul fails with this error:

$ kubectl logs -f consul-0
==> CRITICAL: Permission denied for data folder at "/var/lib/consul/mdb"!
==> Consul will refuse to boot without access to this directory.
==> Please correct permissions and try starting again.

I was able to get around it by using /consul/data as the mountPath. The Consul image entrypoint sets the right permissions for this path when launching Consul.

I'm not sure if this error is specific to Minikube, but I imagine volume mounts in general would be owned by root and would have the same issue. I guess the issue here is that Consul runs as a non-root user, which is unconventional for Docker images.

pbitty avatar Dec 28 '16 20:12 pbitty

Hi,

I am also running this tutorial with a local minikube cluster and even after changing the mountPath to /consul/data, it seem to be not working. Performing a kubectl get pods and getting the logs resulted in what you see below.

screen shot 2016-12-30 at 6 56 05 pm

naiduarvind avatar Dec 30 '16 10:12 naiduarvind

@naiduarvind It looks like Consul is still trying to use /var/lib/consul. When I made this change, I also removed the arg -data-dir=/var/lib/consul from the StatefulSet. See if that works for you.

pbitty avatar Dec 30 '16 17:12 pbitty

@pbitty 's solution works, but it doesn't change /var/lib from being the recommended unix folder for storing DB state. This is probably a bug in minikube?

haf avatar Jan 02 '17 18:01 haf

I was having the same issue with the v0.9.0 Consul container. I updated the paths used in my pull request to update to v0.9.0, #15, which resolved the issue.

blachniet avatar Aug 02 '17 22:08 blachniet