|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: "Kubernetes 1.27: Single Pod Access Mode for PersistentVolumes Graduates to Beta" |
| 4 | +date: 2023-04-20 |
| 5 | +slug: read-write-once-pod-access-mode-beta |
| 6 | +--- |
| 7 | + |
| 8 | +**Author:** Chris Henzie (Google) |
| 9 | + |
| 10 | +With the release of Kubernetes v1.27 the ReadWriteOncePod feature has graduated |
| 11 | +to beta. In this blog post, we'll take a closer look at this feature, what it |
| 12 | +does, and how it has evolved in the beta release. |
| 13 | + |
| 14 | +## What is ReadWriteOncePod? |
| 15 | + |
| 16 | +ReadWriteOncePod is a new access mode for |
| 17 | +[PersistentVolumes](/docs/concepts/storage/persistent-volumes/#persistent-volumes) (PVs) |
| 18 | +and [PersistentVolumeClaims](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVCs) |
| 19 | +introduced in Kubernetes v1.22. This access mode enables you to restrict volume |
| 20 | +access to a single pod in the cluster, ensuring that only one pod can write to |
| 21 | +the volume at a time. This can be particularly useful for stateful workloads |
| 22 | +that require single-writer access to storage. |
| 23 | + |
| 24 | +For more context on access modes and how ReadWriteOncePod works read |
| 25 | +[What are access modes and why are they important?](/blog/2021/09/13/read-write-once-pod-access-mode-alpha/#what-are-access-modes-and-why-are-they-important) |
| 26 | +in the _Introducing Single Pod Access Mode for PersistentVolumes_ article from 2021. |
| 27 | + |
| 28 | +## Changes in the ReadWriteOncePod beta |
| 29 | + |
| 30 | +The ReadWriteOncePod beta adds support for |
| 31 | +[scheduler preemption](/docs/concepts/scheduling-eviction/pod-priority-preemption/) |
| 32 | +of pods using ReadWriteOncePod PVCs. |
| 33 | + |
| 34 | +Scheduler preemption allows higher-priority pods to preempt lower-priority pods, |
| 35 | +so that they can start running on the same node. With this release, pods using |
| 36 | +ReadWriteOncePod PVCs can also be preempted if a higher-priority pod requires |
| 37 | +the same PVC. |
| 38 | + |
| 39 | +## How can I start using ReadWriteOncePod? |
| 40 | + |
| 41 | +With ReadWriteOncePod now in beta, it will be enabled by default in cluster |
| 42 | +versions v1.27 and beyond. |
| 43 | + |
| 44 | +Note that ReadWriteOncePod is |
| 45 | +[only supported for CSI volumes](/docs/concepts/storage/persistent-volumes/#access-modes). |
| 46 | +Before using this feature you will need to update the following |
| 47 | +[CSI sidecars](https://kubernetes-csi.github.io/docs/sidecar-containers.html) |
| 48 | +to these versions or greater: |
| 49 | + |
| 50 | +- [csi-provisioner:v3.0.0+](https://github.com/kubernetes-csi/external-provisioner/releases/tag/v3.0.0) |
| 51 | +- [csi-attacher:v3.3.0+](https://github.com/kubernetes-csi/external-attacher/releases/tag/v3.3.0) |
| 52 | +- [csi-resizer:v1.3.0+](https://github.com/kubernetes-csi/external-resizer/releases/tag/v1.3.0) |
| 53 | + |
| 54 | +To start using ReadWriteOncePod, create a PVC with the ReadWriteOncePod access mode: |
| 55 | + |
| 56 | +```yaml |
| 57 | +kind: PersistentVolumeClaim |
| 58 | +apiVersion: v1 |
| 59 | +metadata: |
| 60 | + name: single-writer-only |
| 61 | +spec: |
| 62 | + accessModes: |
| 63 | + - ReadWriteOncePod # Allow only a single pod to access single-writer-only. |
| 64 | + resources: |
| 65 | + requests: |
| 66 | + storage: 1Gi |
| 67 | +``` |
| 68 | +
|
| 69 | +If your storage plugin supports |
| 70 | +[dynamic provisioning](/docs/concepts/storage/dynamic-provisioning/), |
| 71 | +new PersistentVolumes will be created with the ReadWriteOncePod access mode applied. |
| 72 | +
|
| 73 | +Read [Migrating existing PersistentVolumes](/blog/2021/09/13/read-write-once-pod-access-mode-alpha/#migrating-existing-persistentvolumes) |
| 74 | +for details on migrating existing volumes to use ReadWriteOncePod. |
| 75 | +
|
| 76 | +## How can I learn more? |
| 77 | +
|
| 78 | +Please see the [alpha blog post](/blog/2021/09/13/read-write-once-pod-access-mode-alpha) |
| 79 | +and [KEP-2485](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/2485-read-write-once-pod-pv-access-mode/README.md) |
| 80 | +for more details on the ReadWriteOncePod access mode and motivations for CSI spec changes. |
| 81 | +
|
| 82 | +## How do I get involved? |
| 83 | +
|
| 84 | +The [Kubernetes #csi Slack channel](https://kubernetes.slack.com/messages/csi) |
| 85 | +and any of the standard |
| 86 | +[SIG Storage communication channels](https://github.com/kubernetes/community/blob/master/sig-storage/README.md#contact) |
| 87 | +are great mediums to reach out to the SIG Storage and the CSI teams. |
| 88 | +
|
| 89 | +Special thanks to the following people whose thoughtful reviews and feedback helped shape this feature: |
| 90 | +
|
| 91 | +* Abdullah Gharaibeh (ahg-g) |
| 92 | +* Aldo Culquicondor (alculquicondor) |
| 93 | +* Antonio Ojea (aojea) |
| 94 | +* David Eads (deads2k) |
| 95 | +* Jan Šafránek (jsafrane) |
| 96 | +* Joe Betz (jpbetz) |
| 97 | +* Kante Yin (kerthcet) |
| 98 | +* Michelle Au (msau42) |
| 99 | +* Tim Bannister (sftim) |
| 100 | +* Xing Yang (xing-yang) |
| 101 | +
|
| 102 | +If you’re interested in getting involved with the design and development of CSI |
| 103 | +or any part of the Kubernetes storage system, join the |
| 104 | +[Kubernetes Storage Special Interest Group](https://github.com/kubernetes/community/tree/master/sig-storage) (SIG). |
| 105 | +We’re rapidly growing and always welcome new contributors. |
0 commit comments