minikube: Permission denied for `/var/lib/{folder}`

Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG
Minikube version (use minikube version): v0.14.0

Environment:

  • OS (e.g. from /etc/os-release): OS X 10.11.6
  • VM Driver (e.g. cat ~/.minikube/machines/minikube/config.json | grep DriverName): virtualbox
  • Docker version (e.g. docker -v): Docker version 1.12.0, build 8eab29e
  • Install tools: ??
  • Others: ??

What happened:

I’m trying to set up a StatefulSet with minikube. It’s failing, both for Consul and ZooKeeper. Repro:

 kubectl create -f https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/master/docs/tutorials/stateful-application/zookeeper.yaml

From the Kubernetes blog entry.

Also see this issue.

What you expected to happen:

It to work.

How to reproduce it (as minimally and precisely as possible):

 kubectl create -f https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/master/docs/tutorials/stateful-application/zookeeper.yaml

Anything else do we need to know: No.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 28 (13 by maintainers)

Most upvoted comments

I am trying to run zookeeper on minikube aswell.

When I use this security context I get a permission denied error:

      securityContext:
        runAsUser: 1000
        fsGroup: 1000

But without the runAsUser it works fine:

      securityContext:
        fsGroup: 1000

Could minikube work around this while the main project considers the change?

I got this working by making a derivative of the official Jenkins Docker image that uses root instead of UID 1000. It’s the only way I could get past the permissions errors with the minikube hostpath provisioner. Dockerfile looks like this:

FROM jenkins:2.46.2-alpine

# Run as root to fix permission errors in Minikube
USER root
 
# Make root the owner of all files
RUN chown -R root "$JENKINS_HOME" /usr/share/jenkins/ref

After ignoreing this for a while i had to come back to it and figure it out. You have to enable “standard” class storeage minikube addon enable default-storageclass

Then I can get the helm chart for jenkins to work by adding to the values.yaml:

Persistence:
  StorageClass: standard

You can probably dig into the chart to see why this works. i haven’t yet.

Thanks!

FYI, I tried out this commit and it seems to work: https://github.com/dlorenc/kubernetes/commit/824d1f0c21a11d1c259e45fd8741764a9a125870

Hopefully we can get some clarity on why this hasn’t been implemented in k8s yet.