openshift persistent volumes

2019-09-09 23:12发布

can we use same NFS persistent volume for multiple pods in openshift v3.1. because what I noticed is when I mount the same persistent volumes to multiple pods, all data inside mounted directory of container gets replaced by NFS volume directory of server. How to make sure that NFS volume has data from multiple pods. And pods only has their data, not all data from the PV?

thanks in advance!

2条回答
▲ chillily
2楼-- · 2019-09-09 23:30

NFS persistent volumes will be the same across multiple pods. You can always use the pod name as an environment variable and have each pod set up a unique sub directory. But it is not possible to mount the same NFS volume and have the root directory not be identical.

查看更多
疯言疯语
3楼-- · 2019-09-09 23:31

@priyank - I think if you want to restrict data/directories on your shared storage, you could pass in supplementalGroups from the securityContext and then set up the ownership and groups on the NFS server i.e. dir1 open to groups A and B and then dir1/dirA only open to podA and dir1/dirB only open podB - so all pods have access to dir1 but then only podA has access to dirA and podB has access to dirB. But what clayton said above is true regarding the root directory of the share

查看更多
登录 后发表回答