Closed
Description
Is this a BUG REPORT or FEATURE REQUEST? (choose one): bug report
Please provide the following details:
Environment:
Minikube version (use minikube version
): v0.21.0
- OS (e.g. from /etc/os-release): ubuntu 17.04
- VM Driver (e.g.
cat ~/.minikube/machines/minikube/config.json | grep DriverName
): virtualbox - ISO version (e.g.
cat ~/.minikube/machines/minikube/config.json | grep -i ISO
orminikube ssh cat /etc/VERSION
): minikube-v0.20.0.iso - Install tools:
- Others:
What happened:
- I provision a PVC
- It is dynamically bound to a hostPath volume by the minikube provisioner
- A pod is created that mounts the PVC
- The process in the pod is running as uid 1000, with fsgid 1000 too
- The process can not write to the PVC mount, since it is only writeable by root
Since we don't want to allow escalating privileges in the pod, we can't use the PVC mount at all.
What you expected to happen:
Some way of specifying in the PVC what uid / gid the hostPath should be owned by, so we can write to it.
How to reproduce it (as minimally and precisely as possible):
kubectl apply -f the following file:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: "0"
---
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
volumes:
- name: test
persistentVolumeClaim:
claimName: test
containers:
- image: busybox:latest
name: notebook
volumeMounts:
- mountPath: /home/test
name: test
command: ["/bin/sh", "-c", "touch /home/test/hi"]
securityContext:
fsGroup: 1000
runAsUser: 1000
It fails with the following output:
touch: /home/test/hi: Permission denied
If you set the fsGroup and runAsUser to 0, it succeeds.