Do not have permission to write to emptyDir

2019-05-10 07:45发布

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?

标签: kubernetes
2条回答
相关推荐>>
2楼-- · 2019-05-10 08:10

Disabling SELinux fixed the issue

setenforce 0
查看更多
冷血范
3楼-- · 2019-05-10 08:25

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
查看更多
登录 后发表回答