Skip to content

Commit 5dbf21b

Browse files
committed
Update blog: Kubernetes v1.26: Retroactive Default StorageClass
* The version notation for Kubernetes should be consistent. * Change the command line kc to kubectl. Signed-off-by: ydFu <[email protected]>
1 parent 4f8be8d commit 5dbf21b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

content/en/blog/_posts/2023-01-05-retroactive-default-storage-class.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: blog
3-
title: "Kubernetes 1.26: Retroactive Default StorageClass"
3+
title: "Kubernetes v1.26: Retroactive Default StorageClass"
44
date: 2023-01-05
55
slug: retroactive-default-storage-class
66
---
@@ -11,7 +11,7 @@ The v1.25 release of Kubernetes introduced an alpha feature to change how a defa
1111
StorageClass was assigned to a PersistentVolumeClaim (PVC). With the feature enabled,
1212
you no longer need to create a default StorageClass first and PVC second to assign the
1313
class. Additionally, any PVCs without a StorageClass assigned can be updated later.
14-
This feature was graduated to beta in Kubernetes 1.26.
14+
This feature was graduated to beta in Kubernetes v1.26.
1515

1616
You can read [retroactive default StorageClass assignment](/docs/concepts/storage/persistent-volumes/#retroactive-default-storageclass-assignment)
1717
in the Kubernetes documentation for more details about how to use that,
@@ -146,23 +146,35 @@ If you would like to see the feature in action and verify it works fine in your
146146
The PVC won't provision or bind (unless there is an existing, suitable PV already present)
147147
and will remain in <code>Pending</code> state.
148148
149+
```shell
150+
kubectl get pvc
149151
```
150-
$ kc get pvc
152+
153+
The output is similar to this:
154+
```console
151155
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
152156
pvc-1 Pending
153157
```
154158

155159
3. Configure one StorageClass as default.
156160

161+
```shell
162+
kubectl patch sc -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
157163
```
158-
$ kc patch sc -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
164+
165+
The output is similar to this:
166+
```console
159167
storageclass.storage.k8s.io/my-storageclass patched
160168
```
161169

162170
4. Verify that PersistentVolumeClaims is now provisioned correctly and was updated retroactively with new default StorageClass.
163171

172+
```shell
173+
kubectl get pvc
164174
```
165-
$ kc get pvc
175+
176+
The output is similar to this:
177+
```console
166178
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
167179
pvc-1 Bound pvc-06a964ca-f997-4780-8627-b5c3bf5a87d8 1Gi RWO my-storageclass 87m
168180
```

0 commit comments

Comments
 (0)