Do not have permission to write to emptyDir

1/8/2016

I have mounted a emptyDir volume with memory medium to a pod. Then I logged into the pod and tried to create a file in that volume path but I got a permission denied error.

touch a.txt
touch: cannot touch `a.txt': Permission denied

User I used is root. What could be the reason for that?

-- Dimuthu
kubernetes

2 Answers

3/16/2016

Add :z or :Z as a workaround to your mount path to work properly with selinux:

volumeMounts:
- name: etcd-storage
  mountPath: /var/etcd/data:z
-- user2439041
Source: StackOverflow

1/8/2016

Disabling SELinux fixed the issue

setenforce 0
-- Dimuthu
Source: StackOverflow