consul-on-kubernetes
consul-on-kubernetes copied to clipboard
Data dir permissions issue in Minikube
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.
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.

@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 '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?
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.