Skip to content

Commit 27df2ed

Browse files
authored
Merge pull request #24590 from msau42/prebind
storageclass name in pvc needs to be empty to match pv
2 parents dcf0456 + b01c0a2 commit 27df2ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

content/en/docs/concepts/storage/persistent-volumes.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,27 @@ If the PersistentVolume exists and has not reserved PersistentVolumeClaims throu
185185
The binding happens regardless of some volume matching criteria, including node affinity.
186186
The control plane still checks that [storage class](https://kubernetes.io/docs/concepts/storage/storage-classes/), access modes, and requested storage size are valid.
187187

188-
```
188+
```yaml
189189
apiVersion: v1
190190
kind: PersistentVolumeClaim
191191
metadata:
192192
name: foo-pvc
193193
namespace: foo
194194
spec:
195+
storageClassName: "" # Empty string must be explicitly set otherwise default StorageClass will be set
195196
volumeName: foo-pv
196197
...
197198
```
198199

199200
This method does not guarantee any binding privileges to the PersistentVolume. If other PersistentVolumeClaims could use the PV that you specify, you first need to reserve that storage volume. Specify the relevant PersistentVolumeClaim in the `claimRef` field of the PV so that other PVCs can not bind to it.
200201

201-
```
202+
```yaml
202203
apiVersion: v1
203204
kind: PersistentVolume
204205
metadata:
205206
name: foo-pv
206207
spec:
208+
storageClassName: ""
207209
claimRef:
208210
name: foo-pvc
209211
namespace: foo

0 commit comments

Comments
 (0)