Skip to content

How to make a volume read-only? #173

Answered by sergeyberezansky
derselbst asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, I will try to answer your questions and please ask for more clarifications if needed.

  1. With regard to Changing the accessMode of the PV and the PVC to ReadOnlyMany: this functionality is not enforced by Kubernetes on data plane, but only used for scheduling pods. So for example if a PVC mode is set to ReadOnlyMany, K8s will allow attachment of the volume to multiple pods that require read-only access, but will not allow attaching to a pod that requires write access. Unfortunately, the accessMode is not passed to CSI in the NodePublishVolume request hence we cannot enforce it.

  2. Indeed, spec of volume / storageClass is immutable

  3. This is the recommended way to enforce readOnly acc…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@derselbst
Comment options

Answer selected by derselbst
Comment options

You must be logged in to vote
1 reply
@derselbst
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
good first issue Good for newcomers question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #170 on October 25, 2023 15:35.