-
Notifications
You must be signed in to change notification settings - Fork 53
Directory permission issue when using DaemonSet and PMEM-CSI on OpenShift 4.6.9 #912
Description
I created a local PV and PVC with local storage class(no provisioner) and readWriteMany
access mode for storage sharing between pods:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: shared-volume
spec:
capacity:
storage: 8Gi
accessModes:
- ReadWriteMany
storageClassName: local-storage
local:
path: /tmp
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: storage
operator: In
values:
- pmem
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shared-volume-claim
spec:
storageClassName: local-storage
volumeName: shared-volume
accessModes:
- ReadWriteMany
resources:
requests:
storage: 8Gi
Then I created a daemonSet mount to this volume(path /tmp/memverge
). This daemonSet uses PMEM-CSI to provision PMEM by CSI ephemeral volume(I'm using OpenShift 4.6 and generic ephemeral volume somehow is not supported). Everything works fine and I can attach to my pods(say pod A
) and access the mounted directory. But if I create another pod(say pod B
, which is running on the same node as pod A
) mounting to the same local PV, I no longer able to access /tmp/memverge
in pod A
and get error:
[root@memory-machine-mcz4z /]# ls /tmp/memverge/
ls: cannot open directory '/tmp/memverge/': Permission denied
The permission in container is correct:
[root@memory-machine-mcz4z /]# ls -l /tmp/
total 8
-rwx------. 1 root root 701 Dec 4 17:37 ks-script-esd4my7v
-rwx------. 1 root root 671 Dec 4 17:37 ks-script-eusq_sc5
drwxrwsrwt. 11 root root 520 Mar 5 23:12 memverge
If I create more pods mounting to the same local PV, all these pods works fine and I am able to access the mounted dir. But not the pod A.
If I remove the CSI ephemeral volume part in the daemonSet and re-do everything, this issue is gone. The volume spec for PMEM-CSI is as following:
volumes:
- name: pmem-csi-ephemeral-volume
csi:
driver: pmem-csi.intel.com
fsType: "xfs"
volumeAttributes:
size: "20Gi"
This issue seems only happens when daemonSet
is involved. I haven't do